Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in * on line 35
if($_SERVER['REQUEST_METHOD'] =='POST'){
$userid = $_SESSION['userid'];
$todo = $_POST['todo'];
$description = $_POST['description'];
$date = $_POST['date'];
$priority = $_POST['priority'];
$username = $_SESSION['username'];
}
$get_product = mysql_query("SELECT * FROM inlog WHERE userid = '".$_SESSION['userid']."' ORDER BY id DESC");
while ($row = mysql_fetch_assoc($get_product)) { // Line 35
?>
I would like if someone could explain me what I did wrong, Searched the web off, but couldnt solve my problem. Thats why I’m Here 🙂
///////// PROBLEM SOLVED
Next Question:
Im echoing,(instead of dieing) my wrong todo etc.. But the problem is, He still adds it in my DB. Could anyone explain what to do against it, I understand that if he doesnt die, he will still add it, but only gives an message.
I Guess there is no need to put the script in here. But if so. Ill add it.
Most likely something is empty, update your script to locate the problem:
Also make sure you are escaping your variables before you do a query with them. Just the way I casted the userid to an integer.
About the second question:
Best solution according to me: