Re: Modifying a record works but not in actual database?
| From: | Jason Wong | Date: | Sat, 09 Feb 2002 17:51:15 +0000 |
| Subject: | Re: Modifying a record works but not in actual database? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-84113@lists.php.net to get a copy of this message | ||
On Sunday 10 February 2002 00:47, lmlweb@mybc.com wrote:
> I'm trying to set up a "modify record" page, and after testing and
> triple-checking the syntax and form, and even running the query in the
> phpMyAdmin interface to make sure the query is correct.
>
> This is just a snippet of what I've done:
>
> <?php
>
> // open connection
> include ("connectdatabase.inc");
>
> // format names to protects the O'Haras etc.
> $esc_fname = addslashes($fname);
> $esc_lname = addslashes($lname);
> $esc_email = addslashes($email);
> $esc_web = addslashes($web);
>
> // set up query
> $sql = 'UPDATE thistable
> SET FNAME = "$esc_fname", LNAME = "$esc_lname", EMAIL
> = "$esc_email", WEB = "$esc_web"
> WHERE ID = "$id"';
If you print/echo $sql at this point you'll (hopefully) see where you're
going wrong.
If you don't see what you're doing wrong then swap your single quotes for
double quotes and vice-versa.
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
/*
The Killer Ducks are coming!!!
*/