Re: [PHP] problem with INSERT query
From: Viraj Kalinga Abayarathna (viraja_at_unionb.com)
Date: 12/09/03
- Previous message: Jason Wong: "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"
- Reply: irinchiang_at_justeducation.com: "Re: [PHP] problem with INSERT query"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 09 Dec 2003 13:46:52 +0600 To: irinchiang@justeducation.com
VALUES (''irin'', ''788798878'', ''irin@irin.com'', ''no profile'')
in above line, note the two quotes, in both side of each value.. this is
the cause to your DB syntax error.. correct the above line as follows...
($tutor_name,$tutor_contact,$tutor_email,$tutor_profile)";
and try, but investigate for "why you are getting two quotes instead of
one quote.
Viraj
irinchiang@justeducation.com wrote:
>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.
>
>
>
- Previous message: Jason Wong: "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"
- Reply: irinchiang_at_justeducation.com: "Re: [PHP] problem with INSERT query"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|