I am trying to find the url of the latest 'published' wordpress 'post':
code:
SELECT guid FROM wp_posts WHERE post_status='publish' AND post_type='post' ORDER BY post_date_gmt DESC LIMIT 1
It returns this error
quote:
Originally posted by mySQL
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/****/*******/******/************.php on line 666
Could mean empty result set?
I removed 'LIMIT 1' and it returned a list of post url's sorted just how I want.
I also tried:
code:
SELECT guid FROM wp_posts WHERE post_status='publish' AND post_type='post' ORDER BY post_date_gmt DESC LIMIT 0,1
No luck!
Rep
UPDATE: I just read
john-t's thread and it seems we are having the same problem, something to do with LIMIT.