Updating but not inserting on the database php Free xxx webcam chat single adult women
But if a SELECT query finds them they must be there.
In phpmyadmin order the columns or use the search facility to find the records @code green Thanks code green.
a) switch to mysqli to be ready for future PHP changes.
I also would run $query = mysql_query($query) or die(mysql_error()); on the same line for quick debugging.
$select_query = "SELECT * "; $select_query .= "FROM test "; $select_query .= "WHERE user_id = '$user_id'"; $check_user_id = mysqli_query($connection, $select_query); $query = "INSERT INTO test ("; $query .= " user_id, name, message"; $query .= ") VALUES ("; $query .= " '', '', ''"; $query .= ")"; $result = mysqli_query($connection, $query); if ($result) else However, when I use the following code with an if/else statement, it does not work anymore, although the console reports "Success!
$select_query = "SELECT * "; $select_query .= "FROM test "; $select_query .= "WHERE user_id = '$user_id'"; $check_user_id = mysqli_query($connection, $select_query); if (!
See here on how to do that: How to make a redirect in PHP?
I then echo the query, and test it with mysqladmin or other sql tool.
But, when it comes to mysql errors - when something is not providing me an error properly (when debugging that looks like this) - I read line by line.
Even more bizarrely, making another mysql_query() call to try inserting the same thing again comes up with a duplicate key error, as if the record *had* been inserted.
I can even do a select query immediately after the insert and pull back the instered data but it's not there when I look in the datanase or try to pull the record out on a different page.
Search for updating but not inserting on the database php:
My issue with INSERT INTO categories is that its never inserting data into the table and there is no error. And worse, on a remote, identical, database the same code was working.