Leif, great idea.  In the Restoration Hardware site, I am moving all
database calls into database modules, one module per table (like in
Freetrade2).  After each query, I check the success of the query, and
call my freetradeLog function if anything goes wrong.  freetradeLog
accepts a priority argument depending on how bad the situation is. 
Hence, if something really goes wrong (this is already working), I get
email describing all the details of the problem--including the file and
line number.  It is likely that Leon will choose to include this
functionality in Freetrade2, but I don't know since I have done
practically no work on Freetrade2.

Cheers,
-jj

Leif Mortenson wrote:
> 
>     Glad to hear that you got things working.  In the future here is a much
> easier way to track down your problem.
> 
>     $Query = "SELECT id, name FROMX item";
>     $DatabaseResult = mysql_query($Query, $DatabaseLink);
>     if ($DatabaseResult <= 0) {
>         print ("<b>Query:</b> $Query<br><b>Error:</b> " .
> mysql_error($DatabaseLink) . "<br>");
>     }
> 
>     In this case, you will see:
> Query: SELECT id, name FROMX item
> Error: You have an error in your SQL syntax near 'FROMX item' at line 1
>     thus telling you the exact problem.
> 
>     Now you do have to be careful with this because you do NOT want to be
> showing users your queries every time something something goes wrong with your
> database.
> 
>     It seems like there are an awful lot of questions like this on this list.
> What do you guys think of the idea of adding in code after all of the queries in
> Freetrade which check the $DatabaseResult and then call a function if there is a
> problem.  This would make it possible to have a debug and online mode for
> Freetrade.  in debug mode any database errors would be shown as above, while in
> online mode you could display a user friendly message about your site doing
> maintenance.  This would also make it possible to send a message to a site
> administrator or something.
> 
>     Make the code look something like this:
>     function handleQueryError($Query, $dbLink, $file, $line) {
>         if (DEBUG == true) {
>             print ("<b>Query:</b> $Query<br><b>Error:</b> " .
> mysql_error($dbLink) . "<br><b>File: </b>$file <b>Line: </b>$line");
>         } else {
>             print ("This site is currently undergoing maintenance.  Please try
> again later.");
>             // Send mail to administrator here.
>         }
>     }
> 
>     $Query = "SELECT id, name FROMX item";
>     $DatabaseResult = mysql_query($Query, $DatabaseLink);
>     if ($DatabaseResult <= 0) {
>         handleQueryError($Query, $DatabaseLink, __FILE__, __LINE__);
>     } else {
>         // Work with the results of query here
>     }
> 
>     Let me know your thoughts,
> 
> Leif
> 
> Shawn wrote:
> 
> > Thanks to Everyone;
> >
> > I got it working.  I am very embarrased to say that it was one word that was
> > not capitalized, that was mucking up the whole thing.
> > By the way,
> > Does anyone know of a utility that would force Windows NT to to be case
> > sensitive like Linux or Solaris is?  God, would that ever help.
> >
> > Shawn
> >
> > ----- Original Message -----
> > From: "Tommy TradeIT" <[EMAIL PROTECTED]>
> > To: "FreeTrade" <[EMAIL PROTECTED]>
> > Sent: Tuesday, August 29, 2000 6:28 PM
> > Subject: Re: [FreeTrade] Inconsistant Database Access -- PLEASE HELP
> >
> > > Do you keep in mind that its key sensitive on the Soalris and not on your
> > NT
> > > i got the same error msg on my store
> > > until i cheched all my queries for cases. and guess what i found one. If
> > you
> > > get 0 is not a mysql statement it could also be that you have a script
> > > problem for your quick_wiev. If the sql database is emty it returns 0.00
> > > that means that you have to deal with getting nothing back from your
> > query.
> > > But what do i know.
> > > keep It up
> > > Regards Tommy
> > >
> > >
> > >
> > >
> > > ----- Original Message -----
> > > From: "Shawn" <[EMAIL PROTECTED]>
> > > To: "FreeTrade" <[EMAIL PROTECTED]>
> > > Sent: Tuesday, August 29, 2000 7:55 AM
> > > Subject: [FreeTrade] Inconsistant Database Access -- PLEASE HELP
> > >
> > >
> > > > Hi All;
> > > >
> > > > I am getting close to launching my store using Freetrade.  But I have a
> > > very
> > > > strange problem happening now.  I have modified the "quick_order" screen
> > > to
> > > > display all the "Item" info for verifying data entry.  It works great on
> > > my
> > > > local system, with no problems (Win NT4, PHP3, MySQL).  But when I
> > upload
> > > to
> > > > my web server (Solaris, PHP3, MySQL) it fails with the following error.
> > > >
> > > > "Warning: 0 is not a MySQL result index in
> > > >
> > >
> > /home/secrets/public_html/store/front_to_back_entry//modules/screens/quick_v
> > > > iew on line 31"
> > > >
> > > > I have even gone so far as to switch back to an unmodified version of
> > > > "quick_order" and I still get the error, but only on the remote system
> > not
> > > > on my local machine.  Does anyone have any thoughts on this?
> > > >
> > > > Shawn
> > > >
> > > >
> > > >
> > > > ------------------------------------------------------------
> > > > To subscribe:    [EMAIL PROTECTED]
> > > > To unsubscribe:  [EMAIL PROTECTED]
> > > > Site:            http://www.working-dogs.com/freetrade/
> > > > Problems?:       [EMAIL PROTECTED]
> > > >
> > >
> > >
> > >
> > > ------------------------------------------------------------
> > > To subscribe:    [EMAIL PROTECTED]
> > > To unsubscribe:  [EMAIL PROTECTED]
> > > Site:            http://www.working-dogs.com/freetrade/
> > > Problems?:       [EMAIL PROTECTED]
> >
> > ------------------------------------------------------------
> > To subscribe:    [EMAIL PROTECTED]
> > To unsubscribe:  [EMAIL PROTECTED]
> > Site:            http://www.working-dogs.com/freetrade/
> > Problems?:       [EMAIL PROTECTED]
> 
> ------------------------------------------------------------
> To subscribe:    [EMAIL PROTECTED]
> To unsubscribe:  [EMAIL PROTECTED]
> Site:            http://www.working-dogs.com/freetrade/
> Problems?:       [EMAIL PROTECTED]

-- 
if (shannon - jj) * behrens == webEngineer["CLEAR INK�"]:
    print "<i>imagination is the only real medium(sm)</i><br>"


------------------------------------------------------------
To subscribe:    [EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
Site:            http://www.working-dogs.com/freetrade/
Problems?:       [EMAIL PROTECTED]

Reply via email to