error logging MySQL syntax errors?

error logging MySQL syntax errors?

am 27.04.2007 19:15:53 von Tim McGeary

--------------030206070007010705060606
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

I am getting semi-ambiguous messages in the browser like:

> You have an error in your SQL syntax; check the manual that
> corresponds to your MySQL server version for the right syntax to use
> near '' at line 4

Is there a way in my PHP script to turn on a logging that is more
specific about which MySQL statement in the page is the problem? "line
4" certainly doesn't help.

Tim


--------------030206070007010705060606
Content-Type: text/plain; charset=us-ascii

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--------------030206070007010705060606--

Re: error logging MySQL syntax errors?

am 27.04.2007 19:48:55 von Kevin Murphy

--Apple-Mail-11--327043901
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed

put:

echo mysql_error();

right after the sql query.

--
Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada Community College
www.wncc.edu
775-445-3326



On Apr 27, 2007, at 10:15 AM, Tim McGeary wrote:

> I am getting semi-ambiguous messages in the browser like:
>
>> You have an error in your SQL syntax; check the manual that
>> corresponds to your MySQL server version for the right syntax to use
>> near '' at line 4
>
> Is there a way in my PHP script to turn on a logging that is more
> specific about which MySQL statement in the page is the problem?
> "line 4" certainly doesn't help.
>
> Tim
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--Apple-Mail-11--327043901--

RE: error logging MySQL syntax errors?

am 27.04.2007 20:30:18 von Dwight Altman

In case echo mysql_error(); gives you exactly what the browser gave you,
what you need to be doing is echo'ing your SQL statement and checking if
that statement is correct.

Try your SQL statement in a query tool like phpmyadmin, but that still may
say your syntax is wrong.

Regards,
Dwight
> -----Original Message-----
> From: Kevin Murphy [mailto:php@stubborndonkey.com]
> Sent: Friday, April 27, 2007 12:49 PM
> To: tim.mcgeary@Lehigh.EDU
> Cc: php-db@lists.php.net
> Subject: Re: [PHP-DB] error logging MySQL syntax errors?
>
> put:
>
> echo mysql_error();
>
> right after the sql query.
>
> --
> Kevin Murphy
> Webmaster: Information and Marketing Services
> Western Nevada Community College
> www.wncc.edu
> 775-445-3326
>
>
>
> On Apr 27, 2007, at 10:15 AM, Tim McGeary wrote:
>
> > I am getting semi-ambiguous messages in the browser like:
> >
> >> You have an error in your SQL syntax; check the manual that
> >> corresponds to your MySQL server version for the right syntax to use
> >> near '' at line 4
> >
> > Is there a way in my PHP script to turn on a logging that is more
> > specific about which MySQL statement in the page is the problem?
> > "line 4" certainly doesn't help.
> >
> > Tim
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: error logging MySQL syntax errors?

am 28.04.2007 03:16:40 von bedul

plz remind to send to us your aplication.. the problem may cause from your
sintax don't match the version
----- Original Message -----
From: "Tim McGeary"
To:
Sent: Saturday, April 28, 2007 12:15 AM
Subject: [PHP-DB] error logging MySQL syntax errors?


> I am getting semi-ambiguous messages in the browser like:
>
> > You have an error in your SQL syntax; check the manual that
> > corresponds to your MySQL server version for the right syntax to use
> > near '' at line 4
>
> Is there a way in my PHP script to turn on a logging that is more
> specific about which MySQL statement in the page is the problem? "line
> 4" certainly doesn't help.
>
> Tim
>
>


------------------------------------------------------------ ----------------
----


> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: error logging MySQL syntax errors?

am 29.04.2007 23:44:53 von dmagick

bedul wrote:
> plz remind to send to us your aplication.. the problem may cause from your
> sintax don't match the version

No - *don't* send us your application.

Only send us the relevant lines from the script if you can't work it out.

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php