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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.