j152 Posted June 18, 2008 Share Posted June 18, 2008 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. Quote Link to comment Share on other sites More sharing options...
fenway Posted June 18, 2008 Share Posted June 18, 2008 You need to consult a php/mysql tutorial... you're trying to mix CLI syntax with PHP, and it's just a mess. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.