Forum Moderators: coopster

Message Too Old, No Replies

mysql query help!

please help me with that! :) my brain is......

         

canabatz

12:20 pm on Oct 17, 2008 (gmt 0)

10+ Year Member



i got this code that returning wrong results:

$querys2="(SELECT bid_price, count(*) as n from bidding_details where bid_id=$bid_id GROUP BY bid_price DESC HAVING n = 1 ) UNION ALL (SELECT bid_price, count(*) as d from bidding_details where bid_id=$bid_id GROUP BY bid_price DESC HAVING d > 1) limit $eu, $limit ";

the limit is working only on the first query ,the second query is running after the first limit ,so if i got 30 results from the first query and 30 results from the second query ,all will be displayed on the first page

if the first query got 50 results the next query will be displayed in the next page!

this is my first post in this forum :) ,im happy to be with you all!

thanx in davanced!

andrewsmd

12:33 pm on Oct 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't know if this will help but on the MySQL server I use whenever I use a variable I have to put it in {} meaning $bid_id should look like {$bid_id}. I have noticed newer versions of PHP generally don't need this but sometimes they do.

canabatz

12:42 pm on Oct 17, 2008 (gmt 0)

10+ Year Member



i don't think it mater in my situation ,the query is working good ,it is just the limiting problem! :)

thanx.