hellonoko Posted April 3, 2009 Share Posted April 3, 2009 Trying to select the record with the oldest time stamp from my table. <?php $query = "SELECT * FROM `blogs` ORDER BY `lastchecked` DESC LIMIT 1"; $row = mysql_fetch_array($query) or die (mysql_error()); $url = $row[url]; ?> Returns: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home2/sharingi/public_html/scrape/process_blogs.php on line 4 Something obvious im missing? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/152378-solved-ordering-query-by-timestamp-value/ Share on other sites More sharing options...
MadTechie Posted April 3, 2009 Share Posted April 3, 2009 Yep you need to mysql_query before you mysql_fetch ie <?php $query = "SELECT * FROM `blogs` ORDER BY `lastchecked` DESC LIMIT 1"; $result = mysql_query($query); $row = mysql_fetch_array($result ) or die (mysql_error()); $url = $row[url]; ?> Quote Link to comment https://forums.phpfreaks.com/topic/152378-solved-ordering-query-by-timestamp-value/#findComment-800252 Share on other sites More sharing options...
Yesideez Posted April 3, 2009 Share Posted April 3, 2009 Need to mysql_query() it first... $query = mysql_query("SELECT * FROM `blogs` ORDER BY `lastchecked` DESC LIMIT 1"); Quote Link to comment https://forums.phpfreaks.com/topic/152378-solved-ordering-query-by-timestamp-value/#findComment-800254 Share on other sites More sharing options...
hellonoko Posted April 3, 2009 Author Share Posted April 3, 2009 Oh duh... Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/152378-solved-ordering-query-by-timestamp-value/#findComment-800257 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.