Im getting this error...

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /hsphere/local/home/mlongcos/cosdonline.org/conferences/register_05.php on line 155

Cant figure out why this isnt working... somebody please help!

The file is attached

Suggest you echo out your sql statement to verify that it is being built correctly from the supplied variables. In this case it looks like you are using a variable for the table name, but there is no local decalaration of that variable.

when you use mysql_num_rows, you need to specify the pointer you are usign, eg:

$result1 = mysql_query($query1);
$result2 = mysql_query($query2);
echo "There are ".mysql_num_rows($result1)." rows in the first query\n";
echo "There are ".mysql_num_rows($result2)." rows in the second query\n";

//most of the time you use mysql_num_rows in a for loop, eg:
for ($i=0; $i<mysql_num_rows($result1); $i++) {
     $row = mysql_fetch_row($result1);
     echo $row[0]."-".$row[1]."\n";
}

//but if you don't care how many rows there are, you could just do the following:
while ($row = mysql_fetch_row($result2))
     echo $row[0]."-".$row[1]."\n";
}

the for loop and the while loop will do the exact same thing, except one uses result1 and the other result2

oah my bad, I just realized that you had the php file attached and you didn't make the mistake I assumed you did...

try putting some more checks in there to see where your errors are, anywhere you see __LINE__ it will print out the exact line the error occured in the PHP file. Very helpful if you do a lot of copying and pasting of code and don't feel like making unique error messages

$db=mysql_connect($db_loc, $db_usr, $db_pas) or die ("Unable to connect to the database. (". __LINE__.")");
mysql_select_db($db_db, $db)  or die ("Unable to connect to the selected database. (". __LINE__.")");

$echeck=mysql_query("SELECT * FROM $db_tab1 WHERE r_email LIKE '$email'",$db);

if ($echeck == 0) {
	      echo("<b>Error (".__LINE__.")" . mysql_errno($echeck) . ": " . mysql_error($echeck) . "</b>");
}

if (mysql_num_rows($echeck)) {	// E-Mail address already registered
	$message.=">> The E-Mail address you have provided, already exists in our database.\n<br>";
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.