Re: Modifying a record works but not in actual database?
| From: | lmlweb@mybc.com | Date: | Sat, 09 Feb 2002 18:10:13 +0000 |
| Subject: | Re: Modifying a record works but not in actual database? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-84116@lists.php.net to get a copy of this message | ||
Thanks Jason, switching the single and double quotes did the trick!
Now, I'm curious - what's the rule of thumb for when using single quotes
and double quotes?
Thanks!
--
Laurie Landry
lmlweb@mybc.com - email
(604) 693-1120 - voicemail/fax
---- Jason Wong <php-general@gremlins.com.hk> wrote:
> 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!!!
> */
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>