0

Hi! I use a paginate feature on my website, it works great on the front page, but when I use it in the comment section I get this:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/content/56/6296656/html/comments.php on line 77

code:

$query = "SELECT where headm='".$_GET['chead']."' AND COUNT(*) as num FROM $tableName";
	$total_pages = mysql_fetch_array(mysql_query($query));
	$total_pages = $total_pages[num];

I tried adding the 'where' element into it, so it would only count those with that specific title...

'$query = "SELECT COUNT(*) as num FROM $tableName";' Gets every comment...

Why isn't the 'where' element working with it?

Thanks

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by harrypinto11
0

Where should be at the end:

$query = "SELECT COUNT(*) as num FROM $tableName  where headm='" . mysql_real_escape_string($_GET['chead']) . "'";

Edited by hielo: n/a

0

MySQL is the best database using with PHP main. I also use it with my PHP sites. One example to connect PHP to MYSQL,
// Retrieve all the data from the "example" table
$result = mysql_query("SELECT * FROM example")
or die(mysql_error());

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.