Jump to content

[SOLVED] Mysql count not returning anything


mikwit

Recommended Posts

This script originally worked, but now is returning nothing for me.  I could always not use the count on the mysql side and use the mysql count results command, but that's not as efficient (I assume) and I'm really trying to build my site to scale well.

the php code involved is

$number=$_GET['a'];
$sql = 'SELECT COUNT(*) AS CNT FROM comments WHERE replyto='.$number; 
$comnum = mysql_query($sql) or die('query broke:<br />');
echo $comnum['CNT'];

This is returning nothing even though there are rows where replyto=$number... I'm almost positive it used to work, but I must have messed up something...

Thanks so much, I would've given up on computers a long time ago if it wasn't for you guy's help.

do a print_r($comnum);

whats it say :)

 

This script originally worked, but now is returning nothing for me.  I could always not use the count on the mysql side and use the mysql count results command, but that's not as efficient (I assume) and I'm really trying to build my site to scale well.

the php code involved is

$number=$_GET['a'];
$sql = 'SELECT COUNT(*) AS CNT FROM comments WHERE replyto='.$number; 
$comnum = mysql_query($sql) or die('query broke:<br />');
echo $comnum['CNT'];

This is returning nothing even though there are rows where replyto=$number... I'm almost positive it used to work, but I must have messed up something...

Thanks so much, I would've given up on computers a long time ago if it wasn't for you guy's help.

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.