Re: [PHP] problem with INSERT query

From: Viraj Kalinga Abayarathna (viraja_at_unionb.com)
Date: 12/09/03

  • Next message: irinchiang_at_justeducation.com: "Re: [PHP] problem with INSERT query"
    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.
    >
    >
    >


  • Next message: irinchiang_at_justeducation.com: "Re: [PHP] problem with INSERT query"

    Relevant Pages

    • Re: VB INSERT INTO
      ... Numeric value shouldn't have quotes around them, so if, for example, ... -2147217900 Syntax error in INSERT INTO statement. ... strSQL" without the quotes. ... Set conDatabase = CurrentProject.Connection ...
      (microsoft.public.access.modulesdaovba)
    • Re: running vbscript syntax error
      ... A string must be passed to the Run method. ... The double quotes in the string are resolved to single quotes. ... To troubleshoot, run a script where you define the value of strCmd as above, ... is a syntax error, perhaps due to unbalanced quotes, you can fix it. ...
      (microsoft.public.scripting.vbscript)
    • Re: Multi Field SQL Where Clause
      ... Yes, it should have been a single quote, not three quotes. ... And the MsgBox should have been "MsgBox strWhere". ... sysNtDvNo = sysPUOHDvNo ... When I remove the two additional quotes the syntax error goes away but the functionality is still absent. ...
      (microsoft.public.access.forms)
    • Re: gawk for windows: system() does not yield exit status
      ... Your syntax throws sytax errors under XP because of the single quotes ... it would throw syntax error on *any* platform (even non- ... Now you might suspect that seterlev does not set the exit code in the ...
      (comp.lang.awk)
    • Re: Need correct conditional statement language
      ... there is a syntax error (comma) in the formula. ... double quotes). ...
      (microsoft.public.access.queries)