Re: [php] INSERT INTO
| From: | Jason Wong | Date: | Tue, 17 Dec 2002 08:06:35 +0000 |
| Subject: | Re: [php] INSERT INTO | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-128521@lists.php.net to get a copy of this message | ||
On Tuesday 17 December 2002 15:12, John Taylor-Johnston wrote:
> I'm particularily concerned aboute single quotes. How do I escape them?
> Should I?
>
> Here is what I think is right.
>
> ----------snip----------
> $myconnection = mysql_connect($server,$user,$pass);
> mysql_select_db($db,$myconnection);
>
> $query = "INSERT INTO testals VALUES (addslashes($part1),
> addslashes($part2), addslashes($part3), addslashes($part4));";
Functions inside a string would have no effect. Do this instead:
$part1 = addslashes($part1);
...
...
$query = "INSERT INTO testals VALUES ($part1,...
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
I'm sitting on my SPEED QUEEN ... To me, it's ENJOYABLE ... I'm WARM
... I'm VIBRATORY ...
*/