Collegeboox Posted February 22, 2011 Share Posted February 22, 2011 This is the full error...Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in This is what I am trying to do... 1. get data from the page before which it gets fine in the $_GET function... 2. then set the sersion[username] to $username...(I think I am doing something wrong there) 3. then if the $username doesnt match the username pulled from the database (according to the $_GET info) then open a different databse and update a value in that table. 4. then kill the code die (); someone please help I have been trying to figure this out all day <?php $username = $_SESSION['username']; $deleted = $_GET['deleted']; // Connect to MySQL $connect = mysql_connect("db","user","pass") or die("Not connected"); mysql_select_db("dv") or die("could not log in"); // grab the information according to the isbn number $query = "SELECT * FROM 'boox' WHERE isbn='$deleted'"; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { if ($username==$row['username']) { echo"Welcome, ".$_SESSION['username'].""; // Delete entry where isbn number matches accordingly mysql_query("DELETE * FROM 'boox' WHERE isbn='$deleted'"); } elseif ($username!=$row['username']) { $username = $_SESSION['username']; $connect = mysql_connect("db","user","pass") or die("Not connected"); mysql_select_db("db") or die("could not log in"); // run a query to deactivete a account $acti = mysql_query("UPDATE 'desiredusers' SET activated='2' WHERE username='$username'"); $byebye = "SELECT * FROM 'desiredusers' WHERE isbn='$deleted'"; $results = mysql_query($byebye); while($row2 = mysql_fetch_array($results)) echo "here".$username."here"; die("Your account is deactivated contact College Boox Store to get your account back."); } else echo "there is nothing being checked" . $username . ""; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/228540-getting-an-error-supplied-argument-is-not-a-valid-mysql-result-resource/ Share on other sites More sharing options...
Psycho Posted February 23, 2011 Share Posted February 23, 2011 Your query is failing. You need to see what the MySQL error is. Change the line that runs the query so you can see the error $result = mysql_query($query) or die(mysql_error()."<br />\nQuery:{$query}"); Quote Link to comment https://forums.phpfreaks.com/topic/228540-getting-an-error-supplied-argument-is-not-a-valid-mysql-result-resource/#findComment-1178397 Share on other sites More sharing options...
sasa Posted February 23, 2011 Share Posted February 23, 2011 change $query = "SELECT * FROM 'boox' WHERE isbn='$deleted'"; to $query = "SELECT * FROM `boox` WHERE isbn='$deleted'"; change ' to ` Quote Link to comment https://forums.phpfreaks.com/topic/228540-getting-an-error-supplied-argument-is-not-a-valid-mysql-result-resource/#findComment-1178525 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.