I'm trying to reset the data in my variable so I can call from it again. If there is data in the first query, I need it to run the reset. First I'm checking for data, and second, if there is data, I'm setting the index back to 0.
This works in my localhost environment, but not in my live environment. I know I'm getting the error I am getting because the first query isn't turning up any results, so mysql_num_rows($query)
is empty.
I get the error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource.
(This code works when the first query turns up results, successfully resetting and displaying the second query.)
if (mysql_num_rows($query)){
mysql_data_seek($query, 0);
}
Is there a better way I can check if the first query has information, without spitting out an error if there isn't any information found?