kev wood Posted May 30, 2008 Share Posted May 30, 2008 i want to pull a result from a mysql table but instead of echoing the result out i want to set it to equal a variable. would the code look like this $query = "SELECT email_count FROM sent_messages"; $result=mysql_query($query); while($row=mysql_fetch_array($result, MYSQL_ASSOC)){ $sent_mail = $row['sent_messages']; it is the line with $sent_mail i am unsure about Quote Link to comment Share on other sites More sharing options...
blirette Posted May 30, 2008 Share Posted May 30, 2008 It should do the trick. Just try it! Be sure to do something with the variable before the loop restart because it'll be reassigned on the second pass thought! Quote Link to comment Share on other sites More sharing options...
kev wood Posted May 30, 2008 Author Share Posted May 30, 2008 could it be written without this line in while($row=mysql_fetch_array($result, MYSQL_ASSOC)) as there is only one value inside the table for it to pick from 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.