Ok, here's my problem.
I'm coding a database for a friend of mine (first time I've done this sort of program) for a game he plays.
In the game you can "scout" someone, and you get information on the "kingdom" they are playing.
I take the scout, break it up into individual values, then save it. So far I have everything fixed, except one little detail.
I am using a SELECT query to see if data for that kingdom already exists. If it doesn't exist the data is saved using INSERT. If it does exist it is saved using UPDATE.
However, here is how I see if the kingdom exists:
$exists = mysql_query($select_query);
if (mysql_num_rows($exists)) {
// various things happen
}
The problem is with mysql_num_rows. When I execute the script I get the error:
Warning: Supplied argument is not a valid MySQL result resource in ../inc/mysql.php on line 58
I'm trying to use mysql_num_rows to find if any rows were found. If no rows where found then no data exists. If rows were found then data does exist.
Is there a different function I should use, or is my problem something entirely different?