Jump to content

assigning Count result to a string


j152

Recommended Posts

Hi all,

 

This is an embarassingly newb-type of question, but I'm a) attempting to count the total number of rows in my table b) assign that total to a $, and c) divide that $ between all the rows in a group, and d) updat the group field with the new total.

 

My mysql version is 4.1. 

 

$orchid_count = mysql> (SELECT COUNT(*) FROM orchids;

$floral_amount = $extra / $orchid_count;

 

Of course, I'm getting a syntax error because I haven't been able to find an explanation of the exact syntax I should use, so I've been trying a variety of things.

I am using this in conjuction with a .php script.

 

Any help would be greatly appreciated.

Link to comment
https://forums.phpfreaks.com/topic/110762-assigning-count-result-to-a-string/
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.