Re: [PHP-DB] DESC & LIMIT

2002-01-07 Thread Miles Thompson

Barry,

Try ORDER BY song_name DESC
and then add a LIMIT.

Simply saying DESC is ambiguous as you are selecting all fields.

Miles

On Monday 07 January 2002 07:55 pm, Barry Rumsey wrote:
> $query = "SELECT * FROM xp_sings,xp_artist,xp_songs WHERE
> xp_artist.artist_id = xp_sings.artist_id AND xp_sings.song_id =
> xp_songs.song_id AND song_name LIKE 'b%'  DESC LIMIT 5"; $req =
> mysql_query($query);
> $res = mysql_num_rows($req);
>
> if ($res == 0)
> { echo "Sorry there is no result.";}
> else
> { while($row = mysql_fetch_array($req))
> {
> extract($row);
>
> It returns as "Sorry there is no result" but if I leave of the DESC and
> limit , it works. Can someone tell me where I'm going wrong.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] DESC & LIMIT

2002-01-07 Thread Barry Rumsey

$query = "SELECT * FROM xp_sings,xp_artist,xp_songs WHERE xp_artist.artist_id = 
xp_sings.artist_id AND xp_sings.song_id = xp_songs.song_id AND song_name LIKE 'b%'  
DESC LIMIT 5";
$req = mysql_query($query);
$res = mysql_num_rows($req);

if ($res == 0)
{ echo "Sorry there is no result.";}
else
{ while($row = mysql_fetch_array($req))
{
extract($row);

It returns as "Sorry there is no result" but if I leave of the DESC and limit , it 
works. Can someone tell me where I'm going wrong.