I changed the 'is' in the query to 'k'.  That did not fix anything.  I am
going to watch the Indy 500 and the Coca-Cola 600 and see if the diversion
cleans my brain and allows me to see why this code is not working.

I agree about the need for database abstraction.  I think this is/was being
done in FT2 but I do not think FT2 is an active project at the moment.  I
should add a db layer to existing code anyway since I have a fairly large
site that will not be upgrading PHP from 3 anytime soon.

I am also starting to rework code into functions as the need to fix/alter
code comes up.  I have also been looking at putting some of it into classes,
session and basket being the first two I would like to do.  PHP might not
have the greatest OO feature set but I still visualize objects better than
procedural code.

Chuck Gartland

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Paul
> Chamberlain
> Sent: Saturday, May 26, 2001 8:52 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [FreeTrade-dev] Basket/Invoice Update inventory_qty
> function
>
>
> Chuck Gartland wrote:
> >       //get quanity available for this SKU
> >       $Query = "SELECT i.Available, i.Reserve, i.Backorder ";
> >       $Query .= "FROM inventory i, invoice_sku is ";
> >       $Query .= "WHERE is.ID = $sku_ID ";
> >       $Query .= "AND is.SKU = i.SKU ";
>
> ERROR 1064: You have an error in your SQL syntax near
> 'is where is.ID=2 AND is.SKU=i.SKU' at line 1
>
> In other words, "is" is a reserved word.  You've probably
> figured that out by now though...  Hopefully you've learned
> from this that if there's any doubt in a query then you
> should run it manually to see what happens.
>
> BTW, I think the way FreeTrade does queries leaves
> something to be desired.  A library function which performs
> the queries and reports errors would make it much more
> convenient to catch errors like this.  In fact, a library
> function which does a query, complains about errors, and
> returns a single row from the result would reduce the
> freetrade code considerably and make a big improvement in
> the error detection.  Of course, less code means less bugs
> and easier maintenance.
>
> I'd rework it for my favorite abstraction layer if I thought
> the changes would be integrated into the project.  But I'd
> also want to give in to the temptation to put nearly all the
> code into functions too.
> --
> Paul Chamberlain, [EMAIL PROTECTED]
> _______________________________________________
> FreeTrade-dev mailing list
> [EMAIL PROTECTED]
> http://share.whichever.com/mailman/listinfo/freetrade-dev
>

_______________________________________________
FreeTrade-dev mailing list
[EMAIL PROTECTED]
http://share.whichever.com/mailman/listinfo/freetrade-dev

Reply via email to