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]
- [FreeTrade] Inconsistant Database Access -- PLEASE H... Shawn
- Re: [FreeTrade] Inconsistant Database Access -- ... Tommy TradeIT
- Re: [FreeTrade] Inconsistant Database Access ... Shawn
- Re: [FreeTrade] Inconsistant Database Acc... Leif Mortenson
- Re: [FreeTrade] Inconsistant Database... ski
- [FreeTrade] [FreeTrade] John King
- [FreeTrade] Tommy TradeIT
- [FreeTrade] Re: [FreeTra... Shannon -jj Behrens
- Re: [FreeTrade] [FreeTrade] Shannon -jj Behrens
- Re: [FreeTrade] Inconsistant Database... Paul Chamberlain
- RE: [FreeTrade] Inconsistant Dat... Leon Atkinson
- RE: [FreeTrade] Inconsistant... T.R. Henigson
- Re: [FreeTrade] Inconsis... Shannon -jj Behrens
- Re: [FreeTrade] Inconsis... Tommy TradeIT

