knowram Posted April 28, 2007 Share Posted April 28, 2007 Give that I am self thought I am still trying to learn some of the simple things. Is it possible to write a query statement that will return the entire table (all rows)? $result = mysql_query("select * from [i]Table[/i]") or die ("nope1"); $row=mysql_fetch_array($result); only returns the first row of the table. And or is there a way to select a column and return what ever is in that column from all rows? Thanks for the help. Quote Link to comment Share on other sites More sharing options...
papaface Posted April 28, 2007 Share Posted April 28, 2007 Yeah: $result = mysql_query("select * from Table ") or die ("nope1"); while($row=mysql_fetch_array($result)) { //echo results } Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted April 28, 2007 Share Posted April 28, 2007 <? $query = mysql_query("SELECT col FROM tbl_name"); while ($row = mysql_fetch_assoc($query)){ echo $row['col'] . '<br>'; } ?> Quote Link to comment Share on other sites More sharing options...
knowram Posted April 28, 2007 Author Share Posted April 28, 2007 Cool Now I know that I could use that loop to push each returned value into a single variable but is there a query that will return it as a single variable already? Quote Link to comment Share on other sites More sharing options...
taith Posted April 28, 2007 Share Posted April 28, 2007 theoretically... yes... $query = mysql_query("SELECT col FROM tbl_name"); while ($row = mysql_fetch_assoc($query)){ $array[]=$row; } print_r($array); now you got a HUGE array of every row from your database... 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.