Re: php-mysql insert via web form problem

From: Date: Fri, 22 Feb 2002 07:58:27 +0000
Subject: Re: php-mysql insert via web form problem
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-17186@lists.php.net to get a copy of this message
i think the query you are sending to mysql should be : insert into pages (page) values ('index') (without \) pdsec@hushmail.com a écrit : > Hi, > I am trying to write a web based form that I can put arbitrary sql > statements into and run them against my mysql db. the form is written using > php btw. > > For read operations this seems to work fine, i.e. select, describe, show > etc. However, when I try to do an insert to a table I get an sql syntax > error and I really can't see the problem. > > I am writting the query in a html textarea called query and then using > this like so: > $result=mysql_query($query,$link); > > I get this error in my browser when I run this: > > results of query: insert into pages (page) values (\'index\') > Error:You have an error in your SQL syntax near '\'index\')' at line 1 > > And the query that produced this error is: > insert into pages (page) values ('index') > > I've verified that this statement works using the commandline mysql > interface. > > As the web server and db I'm trying to get this to work on are remote I'm > not certain of the versions. I've tried using the insert into table_name set > column_name=value form in case it was an older version of mysql , but this > produces much the same error. > > Any suggestion greatly appreciated. > > ~:P > > Hush provide the worlds most secure, easy to use online applications - which solution is right > for you? > HushMail Secure Email http://www.hushmail.com/ > HushDrive Secure Online Storage > http://www.hushmail.com/hushdrive/ > Hush Business - security for your Business http://www.hush.com/ > Hush Enterprise - Secure Solutions for your Enterprise > http://www.hush.com/ > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- Marius Ursache (3563 || 3494) \|/ ____ \|/ "@'/ ,. \`@" /_| \__/ |_\ \__U_/

« previous php.db (#17186) next »