Re: [PHP] problem with INSERT query
irinchiang_at_justeducation.com
Date: 12/09/03
- Next message: irinchiang_at_justeducation.com: "Re: [PHP] problem with INSERT query"
- Previous message: irinchiang_at_justeducation.com: "Re: [PHP] problem with INSERT query"
- In reply to: irinchiang_at_justeducation.com: "Re: [PHP] problem with INSERT query"
- Next in thread: irinchiang_at_justeducation.com: "Re: [PHP] problem with INSERT query"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 9 Dec 2003 15:41:09 +0800 To: php-general@lists.php.net
Well, I tried that and this is what i got:
INSERT INTO tutor (tutor_name, tutor_contact, tutor_email, tutor_profile)
VALUES (''irin'', ''788798878'', ''irin@irin.com'', ''no profile'')
DB Error: syntax error
well, when I echo again, i can successfully see the values I entered. But this
time there's a "DB syntax error"????
and when I went into the database to view, it stil reflect a "NULL" value...
-------------------------------------------------------------------------------
On Tuesday 09 December 2003 15:20, irinchiang@justeducation.com wrote:
> This is what I get after I "echo" my query statement:
>
> INSERT INTO tutor (tutor_name, tutor_contact, tutor_email, tutor_profile)
> VALUES ('NULL', 'NULL', 'NULL', 'NULL')
>
> How come the value is null???
>
> In my INSERT query, I already state my value variable to be the name of the
> fields in my html. Why is it still inserting "NULL" into the database when
> I have entered values in the HTML fields?????
>
> $sql = "INSERT INTO tutor (tutor_name,
> tutor_contact,tutor_email,tutor_profile)
> VALUES
> ('$tutor_name', '$tutor_contact', '$tutor_email',
> '$tutor_profile')";
>
>
> What could be the problem??
> >$tutor_name = $db->quote($POST["tutor_name"]);
> >$tutor_contact = $db->quote($POST["tutor_contact"]);
> >$tutor_email = $db->quote($POST["tutor_email"]);
> >$tutor_profile = $db->quote($POST["tutor_profile"]);
You most probably be wanting to use $_POST instead of $POST.
- Next message: irinchiang_at_justeducation.com: "Re: [PHP] problem with INSERT query"
- Previous message: irinchiang_at_justeducation.com: "Re: [PHP] problem with INSERT query"
- In reply to: irinchiang_at_justeducation.com: "Re: [PHP] problem with INSERT query"
- Next in thread: irinchiang_at_justeducation.com: "Re: [PHP] problem with INSERT query"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|