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. Link to comment https://forums.phpfreaks.com/topic/110762-assigning-count-result-to-a-string/ 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. Link to comment https://forums.phpfreaks.com/topic/110762-assigning-count-result-to-a-string/#findComment-568393 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.