List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:October 31 2001 1:45am
Subject:Re: Having trouble using LIMIT
View as plain text  
At 12:54 AM +0000 10/31/01, Mark Worsdall wrote:
>Hi,
>
>When I do the following in a perl script I get back all the records I want:
>
>$prep = "SELECT id,name FROM go.objectives WHERE subjects_id='1' AND 
>subjectHeadings_id='2' ORDER BY displayOrder";
>
>$sth = $dbh->prepare($prep);
>
>$sth->execute;
>
>
>
>But when I add in the LIMIT statement it returns no records
>
>$prep = "SELECT id,name FROM go.objectives WHERE subjects_id='1' AND 
>subjectHeadings_id='2' LIMIT 1,5 ORDER BY displayOrder";
>
>$sth = $dbh->prepare($prep);
>
>$sth->execute;
>
>
>Any idea why?

Because you're not checking for errors (and apparently don't have
RaiseError enabled).  If you had done either of these things, you would
have found out that the statement is illegal.  (In particular, LIMIT goes
at the end of the query.)

>
>
>
>MySQL table query
>
>
>M.
>--
>Work:- postmasterAThinwick.demon.co.uk  WEB:- http://www.hinwick.demon.co.uk
>Work:- mworsdallATshaftesburysoc.org.uk REPLACE AT with @
>Home:- hinwickATworsdall.demon.co.uk    WEB:- http://www.worsdall.demon.co.uk
>Shadow:- webmasterATshadow.org.uk       WEB:- http://www.shadow.org.uk

Thread
(errno: 40)Eric Dean29 Oct
  • Re: (errno: 40)mickalo29 Oct
  • HOW do I return the results of a count to a variableMark Worsdall31 Oct
    • Re: HOW do I return the results of a count to a variablemickalo31 Oct
    • Re: HOW do I return the results of a count to a variablemickalo31 Oct
    • Re: HOW do I return the results of a count to a variablePaul DuBois31 Oct
      • Re: HOW do I return the results of a count to a variableMark Worsdall31 Oct
        • Re: HOW do I return the results of a count to a variablePaul DuBois1 Nov
  • Having trouble using LIMITMark Worsdall31 Oct
    • Re: Having trouble using LIMITSteve Meyers31 Oct
      • Re: Having trouble using LIMITMark Worsdall31 Oct
    • Re: Having trouble using LIMITPaul DuBois31 Oct
  • Re: HOW do I return the results of a count to a variableAnne Shroeder31 Oct
  • Re: HOW do I return the results of a count to a variableBill Adams1 Nov
    • Re: HOW do I return the results of a count to a variablePaul DuBois1 Nov
  • Re: HOW do I return the results of a count to a variableHarald Fuchs1 Nov
    • Re: HOW do I return the results of a count to a variablePaul DuBois2 Nov