Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
PHP assistance with Key Checking system?
Right, so here's the issue.
I'm making a script which checks the key a user inputs into the database, and returns the value of the "active" setting in the database, this will either be "YES" or "NO" in the database.
Here's the error.
mysql_fetch_array(): supplied argument is not a valid MySQL result resource on line 17
This should return the value of 1: (There is supposed to be a php variable here which is not displaying for some reason)
That key was not found in our database
And here is the code.
Thanks to all in advance. Your assistance is greatly appreciated.
@Chris D, thanks for your answer, I've added what you've suggested, It's still giving the same error on the same line, line 17.
@Jeff P
It's echoing out the key alright: c4a2852361b907347f458cb6c0a74e15
And the SQL statement: SELECT * FROM database_removed.table_removed WHERE keycode = c4a2852361b907347f458cb6c0a74e15
And yes, I am using POST in the HTML form.
2 Answers
- Jeff PLv 78 years agoFavorite Answer
Echo out your SQL statement to see what it says. Is the data for $key showing up?
echo $sql = "SELECT * FROM database_removed.table_removed WHERE keycode = '$key'";
You didn't post your form code--are you sure you're using the post method in your form?
- Chris DLv 68 years ago
Line 12 in your pastebin refers to what I assume is a string parameter, but you aren't quoting it.
Given
$sql = "SELECT * FROM database_removed.table_removed WHERE keycode = $key ";
Should be
$sql = "SELECT * FROM database_removed.table_removed WHERE keycode = '$key' ";