matt82 Posted August 15, 2008 Share Posted August 15, 2008 this is probally a very noobish question but i am haveing trouble getting this piece of code to work, when i run it the browser returns a blank white page. <?php $dbhost = 'localhost'; $dbuser = 'bonehead'; $dbpass = '********'; mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql')or die('Error, Connecting Failed'); $dbname = 'base2'; mysql_select_db($dbname); $query = "SELECT name FROM table1 ORDER BY name DESC LIMIT 0 , 1"; $displ = mysql_fetch_array($query); print $displ ?> I was expecting it to return the value from the last row of the table from the column 'name' and save that value into the $displ value. again sorry bout the noob question. Link to comment https://forums.phpfreaks.com/topic/119782-solved-select-function-noob-question/ Share on other sites More sharing options...
akitchin Posted August 15, 2008 Share Posted August 15, 2008 you aren't actually running the query. you need to use mysql_query() on the query variable first, then pass THAT to mysql_fetch_array(). i've censored your password - in future, i'd consider blanking out your real password when posting code samples. Link to comment https://forums.phpfreaks.com/topic/119782-solved-select-function-noob-question/#findComment-617101 Share on other sites More sharing options...
matt82 Posted August 15, 2008 Author Share Posted August 15, 2008 Yet another noob questions answered so well. Thanks a million Oh and this is just a test app i am building to learn PHP will never see the internet hency why i wasnt worried about the password But thankyou for your concern I was able to get the whole thing working in 10 secs flat. Link to comment https://forums.phpfreaks.com/topic/119782-solved-select-function-noob-question/#findComment-617145 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.