What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » What's wrong with this SQL?

What's wrong with this SQL?
Author: Message:
Baggins
Full Member
***

Avatar
B000ALFAZO

Posts: 387
Reputation: 13
30 / Male / Flag
Joined: Oct 2006
O.P. Shocked  What's wrong with this SQL?
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! :sad:
Rep
UPDATE: I just read john-t's thread and it seems we are having the same problem, something to do with LIMIT.

This post was edited on 01-04-2008 at 03:55 AM by Baggins.
01-04-2008 03:47 AM
Profile E-Mail PM Web Find Quote Report
MeEtc
Patchou's look-alike
*****

Avatar
In the Shadow Gallery once again

Posts: 2200
Reputation: 60
38 / Male / Flag
Joined: Nov 2004
Status: Away
RE: What's wrong with this SQL?
Query looks fine to me, I even ran it in PMA and had a result returned. The only way I can see this failing, is if you don't have any posts made yet on WP
[Image: signature/]     [Image: sharing.png]
I cannot hear you. There is a banana in my ear.
01-04-2008 04:01 AM
Profile PM Web Find Quote Report
Baggins
Full Member
***

Avatar
B000ALFAZO

Posts: 387
Reputation: 13
30 / Male / Flag
Joined: Oct 2006
O.P. RE: What's wrong with this SQL?
Hmmmm, my database is full. However I am using WizMySQLAdmin (pma is kinda slow), so I will try PMA.

EDIT: Works in PMA, thanks MeEtc!

This post was edited on 01-04-2008 at 04:04 AM by Baggins.
01-04-2008 04:02 AM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On