Doomflame Posted April 24, 2003 Share Posted April 24, 2003 I am connected to the database fine, but please give me the code to store the result of the query below in the variable $next. SELECT winner FROM drawings WHERE total = \'1\' Thanks, The NewBie Quote Link to comment https://forums.phpfreaks.com/topic/385-newb-question-about-mysql/ Share on other sites More sharing options...
effigy Posted April 24, 2003 Share Posted April 24, 2003 [php:1:72eff6ee13] $result = mysql_query(\"SELECT winner FROM drawings WHERE total = \'1\'\"); $row = mysql_fetch_array($result); $next = $row[\'winner\']; [/php:1:72eff6ee13] Quote Link to comment https://forums.phpfreaks.com/topic/385-newb-question-about-mysql/#findComment-1302 Share on other sites More sharing options...
Doomflame Posted April 24, 2003 Author Share Posted April 24, 2003 Thanks! How would I make it handle this code if the output will be more than one value for each? SELECT name, owner, value, shares FROM stocks WHERE owner = \'$username\' Quote Link to comment https://forums.phpfreaks.com/topic/385-newb-question-about-mysql/#findComment-1313 Share on other sites More sharing options...
shivabharat Posted April 24, 2003 Share Posted April 24, 2003 same way as said $result = mysql_query("SELECT name, owner, value, shares FROM stocks WHERE owner = \'$username\'"); $row = mysql_fetch_array($result); $na= $row[\'name\']; $ow = $row[\'owner\']; $va = $row[\'value\']; $sh = $row[\'shares\']; Quote Link to comment https://forums.phpfreaks.com/topic/385-newb-question-about-mysql/#findComment-1316 Share on other sites More sharing options...
Doomflame Posted April 24, 2003 Author Share Posted April 24, 2003 No, I mean if it should fetch 5 names, values, and shares.... How would I store them in arrays like this: $name = array("name1", "name2", "name3", "name4", "name5") $values = array("value1", "value2", "value3", "value4", "value5") $shares = array("shares1", "shares2", "shares3", "shares4", "shares5") replacing ___1-5 with the fetched value. Quote Link to comment https://forums.phpfreaks.com/topic/385-newb-question-about-mysql/#findComment-1317 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.