Re: listing question

From: Date: Wed, 12 Apr 2006 00:23:31 +0000
Subject: Re: listing question
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-41694@lists.php.net to get a copy of this message
Chris Payne wrote:
Hi there, I tried something similar: $query = "SELECT * FROM videos WHERE videomakers_website_url = '$x' AND privatepublic = 'public' AND producer_website LIKE '%$x%' OR videomakers_website_url LIKE '%$x%' ORDER BY videomakers_site_position ASC, video_title ASC LIMIT $offset, $item_perpage"; $querytotal = "SELECT count(*) FROM videos WHERE videomakers_website_url = '$x' AND privatepublic = 'public' AND producer_website LIKE '%$x%' OR videomakers_website_url LIKE '%$x%' ORDER BY videomakers_site_position ASC, video_title ASC"; My problem is, it displays not alphabetical videos first and then LAST it displays the videos with numbers, and when I can get the numbers at the top of the listing, they are in the wrong order (IE: 0,1,2 is from the bottom up and not 0 being at the top, 1 being next and so on).
I don't understand what you want (maybe a sample 5 in the order you get and the order you want will help us - include the position field if you send it through). Do you want alphabetical first then numbers? change your order: order by video_title asc, videomakers_site_position asc; if you want numbers first: order by videomakers_site_position asc, video_title asc; Lastly, you don't need to order your results for a count query ($querytotal) :) -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.db (#41694) next »