Jump to content

[SOLVED] Count Records


papaface

Recommended Posts

Hello,

How can I count how many records are in a table that match a news_id?

I have this at the moment, but it doesn't seem to work.

					<?php
				$_getcomments = mysql_query("select count(comment_id) from comments where news_id='{$news_id}'");
				list($__num) = mysql_fetch_array($_getcomments);
				echo $__num;
				?> Comments</div>

I get:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /***/index.php on line 48

Comments

Link to comment
https://forums.phpfreaks.com/topic/49177-solved-count-records/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.