Re: Mysql Insert from select problem with php

From: Date: Fri, 21 Jun 2002 06:18:35 +0000
Subject: Re: Mysql Insert from select problem with php
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-103236@lists.php.net to get a copy of this message
why don't you do a quick fix and just add addslashes again if obviously there is no escap slash present right now? Good luck, Andy -- ---------------------------------------------------- http://www.globosapiens.net Global Travellers Network! "David McInnis" <david@dataovation.com> schrieb im Newsbeitrag news:005001c218e8$699e0c40$221d7041@bigdaddy... > After posting this on the MySQL list and getting some feedback we were > able to determine that this was not a flaw with MySQL. Any ideas from > the PHP community? > > ======= > > Can anyone tell me why this does not work? I am using php and mysql. > > When I do an insert from select into a mysql table I get an error > whenever a value from the select portion of the query contains an > apostrophe. Before I insert the initial value I use the php > addslashes() function to escape the ' and " characters. > > For example: > > If clients table contans a field called fname and it has a value of > "O'Henry". Remembering that I have used addslashes() before inserting > the value into mysql in the first place. > > The following query will fail on insert: > > Sql = "insert into orders (fname) SELECT fname from clients where > clientid = '$clientid'"; > > > David McInnis > >

« previous php.general (#103236) next »