$query2 = "select user_id, first_name, last_name, email from users";
$result2 = mysql_query($query2);
$num = mysql_num_rows(result2);// problem is here
echo $num;
echo '<table border="1"><tr><td>user id</td><td>first name</td><td>last name</td><td>email</td></tr><tr>';
while($row = mysql_fetch_array($result2))
{
echo '<td>' . $row['0'] . '</td>';
echo '<td>' . $row['1'] . '</td>';
echo '<td>' . $row['2'] . '</td>';
i keep getting mysql_fetch_array(): supplied argument is not a valid MySQL result resource.
i have been searching google for ages now and all i can see is 'use single quotes around X parts of the statement'. This is not working.
as you can see, i have included some of the script. the problem is on the mysql_num_rows line. The fetch array loop runs fine and i get the results as i would expect so the statement and syntax must be correct. i just cant count the results.
someone please help me.