-2

The following mysqli query does not execute, since I check my 'users' table and it does not contain any records:

//connection.php//

$db_connect = mysqli_connect('myremotehost', 'myremoteuser', 'mypass', 'mydatabase');

if(mysqli_connect_errno($db_connect)){
echo mysqli_connect_error();
exit();
}

//

include 'database/connection.php';
$username = $_POST['username'];
$password = md5($_POST['password']);
$email = $_POST['email'];
$email_code = md5($_POST['username'] + microtime());
$gender = $_POST['gender'];
$ip = getenv('REMOTE_ADDR');

$sql = "INSERT INTO `users` (username, password, email, email_code, gender, ip, signup, lastlogin, notescheck) VALUES('$username','$password','$email','$email_code','$gender','$ip',NOW(),NOW(),NOW())";
$query = mysqli_query($db_connect, $sql);



 //below are the forms with their respective 'input names' that are equal to: username, email and gender (values 'm' & 'f').

 //The action of the actual form is action="" this file.

I know that this code executes since directly below the $sql and $query variables I have some other code that creates a folder in the /users/ directory upon execution, and whenever I check my online directory it does get created, but again, the problem is that the query does not post anything on the database.

Any suggestions?

Thanks guys!

4

1 に答える 1

0

クエリの後に次の行を追加します。

if (!$query) { die(mysqli_error($db_connect)); }

何かが印刷されるかどうかを確認します。エラーメッセージに従って行動してください。つまり、少なくとも質問に追加してください。

于 2013-07-29T20:47:17.070 に答える