Reputation: 89
While the request completes without an error it doesn't write in the database. It connects to the database i've checked it.
This is my code:
<?php
$json = json_decode(file_get_contents("config.json"), true);
$dbuser = $json['dbuser'];
$servername = $json['dbip'];
$dbpass = $json['dbpass'];
$dbname = $json['dbname'];
$password = $_GET['password'];
$email = $_GET['email'];
// Create connection
$conn = mysqli_connect($servername, $dbuser, $dbpass);
mysql_select_db( $dbname );
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO credentials (usermail, pass)
VALUES ($email, $password)";
?>
Example: http://localhost/php/[email protected]&password=ilovestackoverflow
It just doesn't do anything. Please if you have any ideas
Upvotes: 0
Views: 316
Reputation: 15057
you must quote strings like:
$sql = "INSERT INTO credentials (usermail, pass)
VALUES ('$email', '$password')";
Upvotes: 1