[Gambas-user] problem with "&" and mysql

Benoit Minisini gambas at ...1...
Thu Feb 9 09:37:53 CET 2006


On Thursday 09 February 2006 09:33, Andreas Fröhlke wrote:
> Benoit Minisini schrieb:
> > On Thursday 09 February 2006 08:14, Andreas Fröhlke wrote:
> >>Charlie Reinl schrieb:
> >>>>Hello,
> >>>>
> >>>>I have a problem with mysql and the charakter "&". I like to use a
> >>>>"INSERT"-statement with gambas like:
> >>>>
> >>>>INSERT INTO tabTest SET textfield='Hello & Bye' ;
> >>>>
> >>>>If I use this statement under phpmyadmin it will work, but with gambas
> >>>>it raises an error. Only without the "&"-Charakter it work.
> >>>>Please Help
> >>>>
> >>>>Thanks, A.Fröhlke
> >>>>
> >>>>P.S. Sorry for my bad english, I'm from germany ;)
> >>>
> >>>Salut,
> >>>
> >>>try it with && and think also that ' exists.
> >>>
> >>>Amicalment
> >>>Charlie
> >>>* Gesendet mit / Sent by: FEN-Webmail * http://www.fen-net.de *
> >>>
> >>>
> >>>-------------------------------------------------------
> >>>This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> >>>files for problems?  Stop!  Download the new AJAX search engine that
> >>>makes searching your log files as easy as surfing the  web.  DOWNLOAD
> >>>SPLUNK! http://sel.as-us.falkag.net/sel?cmd=k&kid3432&bid#0486&dat1642
> >>>_______________________________________________
> >>>Gambas-user mailing list
> >>>Gambas-user at lists.sourceforge.net
> >>>https://lists.sourceforge.net/lists/listinfo/gambas-user
> >>
> >>Hi,
> >>
> >>It don't work. My "new" SQL-statement was:
> >>
> >>INSERT INTO tabTest SET textfield='Hello && Bye' ;
> >
> > This should work there. What happens *exactly* ?
> >
> > The syntax of the substitution functions is a bit strange, I should
> > change it maybe...
> >
> > At the moment, '&X' is replaced by the value of the X-th argument if X is
> > a number of one or two digits greater than zero, and if not, it is
> > replaced by 'X'.
> >
> > Regards,
>
> Hello,
>
> If I use the sql statement with gambas like this:
>
> 	db.exec("INSERT INTO tabTest SET textfield='Hello & Bye' ;")
> ERROR:
> Query failed: 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 'Hello & Bye'' at line 1
>
>
> also I tried:
>
> 	db.exec("INSERT INTO tabTest SET textfield='Hello && Bye' ;")
> ERROR:
> Query failed: 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 'Hello && Bye'' at line 1
>
> and:
>
> 	db.exec("INSERT INTO tabTest SET textfield='Hello \\& Bye' ;")
> ERROR:
> Query failed: 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 'Hello \& Bye'' at line 1
>
>
> but nothing work. Only it works if I delete the "&" charakter, but i
> cant't do this, because than I must correct each userinput and correct
> existing data with "&"-charakter in each table.
>
> Please Help
>
> Thanks A.Fröhlke

Remove the ';'. This is not part of SQL syntax!

-- 
Benoit Minisini





More information about the User mailing list