I am trying to determine if a query that I am running on a database is being returned empty. This is the code that I am running:
mysql_connect(localhost,$usernamevideo,$passwordvideo);
@mysql_select_db($databasevideo) or die("Unable to Connect to database");
// accesses the database for information about the channel
$query="SELECT * FROM videochannel WHERE cid = $currentchannelid";
$result = mysql_query($query);
$checknumrows = mysql_num_rows($result);
mysql_close();
if ($checknumrows == 0) {
Something Happens
}
Else {
Something else
}
When I run this, I get the following error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
If I delete the "$checknumrows = mysql_num_rows($result);" then it runs fine, but then I can't use the if statement.
Any suggestions?