Rory_M Posted August 9, 2011 Posted August 9, 2011 Can anyone help me with this, every time i echo it out it just returns "Array". $sql = mysql_query("SELECT `W_Name` FROM `weapons` ORDER BY RAND() LIMIT 1"); $found_sql = mysql_fetch_array($sql); echo $found_sql; Thanks for the help in advance. :) Quote
Lithium Posted August 9, 2011 Posted August 9, 2011 you are not forgetting anything? echo $found_sql['W_Name']; Quote
Dominion Posted August 9, 2011 Posted August 9, 2011 Using order by rand() should be avoided. http://jan.kneschke.de/projects/mysql/order-by-rand/ Quote
Mufasa Posted August 9, 2011 Posted August 9, 2011 also, I find the best way to quickly echo an array to be print_r( $array ) - though there are certainly other options Quote
a_bertrand Posted August 10, 2011 Posted August 10, 2011 I would personally do it like that: For small table, order by rand is a solution... For bigger tables DO NOT use it instead: "SELECT COUNT(*) FROM MY_TABLE" "SELECT * FROM MY_TABLE LIMT ".rnd($maxrow).",1 Quote
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.