Jump to content

Counting values from MySQL


Chris.P

Recommended Posts

I have the following code. Basically I'm trying to count the amount of colours returned in the $colour variable. What I have is always returning 1, any ideas why?

 

$colour = $db->query("SELECT * FROM colours WHERE prod_id = ".$row['prod_id']." AND LENGTH(col_image_1) > 0 ORDER BY col_rank ASC LIMIT 1");
$colourcount = mysql_num_rows($colour);

if($db->numrows($colour)) {
	$colour = $db->fetchrow($colour);
} else {
	unset($colour);
}

 

echo $colourcount;

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/238201-counting-values-from-mysql/
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.