Re: [PHP] problem with INSERT query

irinchiang_at_justeducation.com
Date: 12/09/03


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.



Relevant Pages

  • Re: TC_shell comm questions
    ... Do you realize that NOT ONE of the "syntax error" examples in Bruce ... Barnett's document on Csh - which Morton happily recommended - generates ... % echo "money$" ... NOT THE SAME IN TCSH? ...
    (comp.unix.shell)
  • using the return code of a statement directly
    ... Syntax error: word unexpected ") ... screen, but $myvar doesn't get the expected value. ... $ echo "xxx$yyy" ... echo "not zero" ...
    (comp.unix.shell)
  • Re: php guru help please
    ... And, never having seen them used in php before, I would say that the ... echo $yes; ... Parse error: syntax error, unexpected $end ... You cancelled deleting user $fname $lname with ...
    (Ubuntu)
  • Re: php guru help please
    ... And, never having seen them used in php before, I would say that the ... error is truly a "syntax error" ... ... > here is my stupid code ... > echo $id; ...
    (Ubuntu)
  • Re: Executing shell commands from Ruby... again.
    ... echo off ... That makes perfect sense, but for some reason I'm getting this error: ... syntax error, unexpected $end, expecting tSTRING_CONTENT or ... :) I was merely saying that the batch file ...
    (comp.lang.ruby)