-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alessandro Catania
committed
Dec 21, 2017
1 parent
a5b4b92
commit 1b4c92b
Showing
5 changed files
with
101 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,14 +13,5 @@ | |
die("Connection failed: " . $conn->connect_error); | ||
} | ||
|
||
$sql = "INSERT INTO slots (name, description, operator) VALUES ('Jsdfohn', 'Doe', '[email protected]')"; | ||
|
||
if ($mysqli->query($sql) === TRUE) { | ||
echo "New record created successfully"; | ||
} else { | ||
echo "Error: " . $sql . "<br>" . $mysqli->error; | ||
} | ||
|
||
|
||
$mysqli->close(); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php include("../config.php") ?> | ||
|
||
<?php | ||
$sql = "INSERT INTO slots (name, description, operator) VALUES ('Jsdfohn', 'Doe', '[email protected]')"; | ||
|
||
if ($mysqli->query($sql) === TRUE) { | ||
echo "New record created successfully"; | ||
} else { | ||
echo "Error: " . $sql . "<br>" . $mysqli->error; | ||
} | ||
|
||
|
||
$mysqli->close(); | ||
?> | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Untitled Document</title> | ||
</head> | ||
|
||
<body> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
$img = $_GET[ 'img' ]; | ||
$url = $_GET[ 'url' ]; | ||
$name = $_GET[ 'name' ]; | ||
|
||
if ( !empty( $name ) ) { | ||
|
||
include( "../../config.php" ); //connect to db | ||
|
||
|
||
|
||
|
||
/*$sql = "INSERT INTO slots (name, description, operator) VALUES ('Jsdfohn', 'Doe', '[email protected]')"; | ||
if ($mysqli->query($sql) === TRUE) { | ||
echo "New record created successfully"; | ||
} else { | ||
echo "Error: " . $sql . "<br>" . $mysqli->error; | ||
} | ||
*/ | ||
/*$sql = "SELECT * FROM slots WHERE `img` = `$img`"; | ||
if ( $mysqli->query( $sql )) { | ||
echo "inserting<br>"; | ||
$sql = "INSERT INTO slots (img) VALUES ('$img')"; | ||
if ( $mysqli->query( $sql ) === TRUE ) { | ||
echo "Record Updated successfully"; | ||
} else { | ||
echo "Error: " . $sql . "<br>" . $mysqli->error; | ||
} | ||
} else { | ||
echo "updating!<br>"; | ||
$sql = "UPDATE slots SET img = REPLACE(img, 'foo', 'bar') WHERE INSTR(img, 'foo') > 0"; | ||
if ( $mysqli->query( $sql ) === TRUE ) { | ||
echo "Record Updated successfully"; | ||
} else { | ||
echo "Error: " . $sql . "<br>" . $mysqli->error; | ||
} | ||
}*/ | ||
|
||
$result = $mysqli->query("SELECT id FROM slots WHERE img = '$img'"); | ||
if($result->num_rows == 0) { | ||
// row not found, do stuff... | ||
echo "inserting<br>"; | ||
|
||
//CREATE OPERATOR ARRAY AND CONVERT | ||
|
||
//CREATING NEW ROW(slot) | ||
$sql = "INSERT INTO slots (img,url,name) VALUES ('$img','$url','$name')"; | ||
|
||
if ( $mysqli->query( $sql ) === TRUE ) { | ||
echo "Record Updated successfully"; | ||
} else { | ||
echo "Error: " . $sql . "<br>" . $mysqli->error; | ||
} | ||
} else { | ||
// do other stuff... | ||
echo "date already taken"; | ||
/*echo "updating name!<br>"; | ||
if(!empty( $name )){ | ||
$sql = "UPDATE slots SET img='$name' WHERE img='$name'"; | ||
if ( $mysqli->query( $sql ) === TRUE ) { | ||
echo "Record Updated successfully"; | ||
} else { | ||
echo "Error: " . $sql . "<br>" . $mysqli->error; | ||
} | ||
}*/ | ||
} | ||
|
||
|
||
|
||
$mysqli->close(); | ||
} |