If you've gotten the error "Supplied argument is not a valid MySQL resource" you're in luck because so has everyone else that has ever used PHP... ever. The error is caused by a number of things including: Your query is wrong, you failed to connect to the database or you selected the wrong database.
Now, before you go start modifying your code make sure you've used the correct username, password and host for your mysql_connect function and you've selected the correct database. If you've done this and you're still getting an error follow the steps below.
So to figure out which of these happened we're going to use the mysql_error() function which tells us what went wrong last:1) Your connection string should look something along the lines of the following:
$conn = mysql_connect('host', 'user', 'pass');
if(!$conn) {
// echo or use die() here, your choice.
echo mysql_error();
}
2) Your database select statement should look similar:
$dbselect = mysql_select_db('dbname');
if(!$dbselect) {
// once again, echo or die your choice
echo mysql_error();
}
3) Finally do the same for your mysql_query() call:
$result = mysql_query('SELECT * FROM some_table WHERE blah = "blah"');
if(!$result) {
echo mysql_error();
}
If these steps don't solve your error use the Daniweb Search functionality to find other people with similar problems, I can guarantee you aren't the first.
Finally as a LAST resort, and I emphasize last because, as I said, your question has been asked before, post a new topic being as specific as possible about your problem. Post your code along with the exact error and line numbers. Most importantly, USE CODE TAGS. If you don't use code tags you will most likely be ignored by a large number of our members.
Hope this has been helpful and we all look forward to seeing you in the future.
Good Luck.
Edit: If you have any additions please PM and I will consider them. Do NOT PM me with your questions.