NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP Error - Need Help Debugging

Andy Dirnberger dirn at dirnonline.com
Wed Apr 12 21:39:09 EDT 2006


To get your original code to work, the ($pagecount-1)*10-1 expression needs
to be in parentheses: (($pagecount-1)*10-1)

DiRN

-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On
Behalf Of IAlsoAgree at stny.rr.com
Sent: Wednesday, April 12, 2006 9:22 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] PHP Error - Need Help Debugging

Adding your $start line fixed the problem.

Once again, MySQL has no problem with double or single quotes. You can
use them interchangably. I've done this both via PHP and on the command
line and never had any problems with it.

I still don't understand what I had done wrong in my previous code. What
there would have returned that error, any ideas?

Thanks,
-Joe

----- Original Message -----
From: edward potter <edwardpotter at gmail.com>
Date: Wednesday, April 12, 2006 9:16 pm
Subject: Re: [nycphp-talk] PHP Error - Need Help Debugging
To: NYPHP Talk <talk at lists.nyphp.org>

> I don't think I've every used double quotes in sql, and why not covert
> this to a variable value ahead of time? Looks a bit scarry. And then
> just stick that in. At least it makes it a bit easier to debug, and
> more readable.
> 
> $id = $_GET[id];
> $start = (($pagecount-1)*10)-1;
> 
> etc.
> 
> -ed  :-)
> 
> On 4/12/06, IAlsoAgree at stny.rr.com <IAlsoAgree at stny.rr.com> wrote:
> > I'm sure it's going to be something really obvious, but for now I 
> just> can't seem to figure out what it is.
> >
> > I'm getting the following error:
> > Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING
> >
> > The line of code is:
> > $checkreplies = "SELECT posts.postid, posts.subject, posts.body,
> > posts.created, users.userid, users.username, users.aim, 
> users.created,> users.admin FROM posts, users WHERE posts.postid = 
> \"$_GET[id]\" AND
> > posts.userid = users.userid AND posts.replyto = $_GET[postid] LIMIT
> > ".($pagecount-1)*10-1.", 10";
> >
> > >From what I can gather, it sounds like I misused a double quote or
> > misplaced a peroid. But looking at the code, I can't see where I did
> > either wrong.
> >
> > Anyhelp would be appreciated.
> >
> > Thanks,
> > -Joe
> > _______________________________________________
> > New York PHP Community Talk Mailing List
> > http://lists.nyphp.org/mailman/listinfo/talk
> > New York PHP Conference and Expo 2006
> > http://www.nyphpcon.com
> > Show Your Participation in New York PHP
> > http://www.nyphp.org/show_participation.php
> >
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
> New York PHP Conference and Expo 2006
> http://www.nyphpcon.com
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
> 
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
New York PHP Conference and Expo 2006
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php




More information about the talk mailing list