Re: What is diff between SQL .... VALUES ($a.$b) and SQL .... VALUES (a,b)?

From: Date: Mon, 03 Sep 2001 18:43:03 +0000
Subject: Re: What is diff between SQL .... VALUES ($a.$b) and SQL .... VALUES (a,b)?
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-1422@lists.php.net to get a copy of this message
Hi, thx for your answer, but i made several cases, the consequences of which do not comply with your suggestion... I think :-) A.
                $sql = "INSERT INTO messages (timestamp, n10cybername , n12msgpub)";
                $sql .= "VALUES (unix_timestamp() , n10cybername  , n12msgpub )";
gives
        "Your data were successfully saved."
but ......
        empty fields in the tablerow :-(
B.
                $sql = "INSERT INTO messages (timestamp, n10cybername , n12msgpub)";
                $sql .= "VALUES (unix_timestamp() , $n10cybername  , $n12msgpub )";
gives:
                MySQL Error: 1064 (You have an error in your SQL syntax near ' '', )' at line 1)
C.
                $sql = "INSERT INTO messages (timestamp, n10cybername , n12msgpub )";
                $sql .= "VALUES (unix_timestamp() . $n10cybername . $n12msgpub )";
gives:
        MySQL Error: 1064 (You have an error in your SQL syntax near '. '10 Cybername', . '', )' at line 1)
                (BTW, where can i find the meaning of errorcode 1064? )
I hope my cases are specific enough to describe my problem(s) regards Jan Holland At 07:40 PM 9/3/01, you wrote:
So sprach »Jan Holland« am 2001-09-03 um 19:29:43 +0200 : $sql = "INSERT INTO messages (timestamp, n1type, n6doel )"; $sql .= "VALUES (unix_timestamp() . $n1type . $n6doel )"; I think you mixed up , and . in the 2nd row. $sql = "INSERT INTO messages (timestamp, n1type, n6doel)"; $sql .= "VALUES (unix_timestamp() , n1type , n6doel )"; And this time you forgot to tell PHP that n1type and n6doel are variables, ie. you forgot the $. Alexander Skwar -- How to quote: http://learn.to/quote (german) http://quote.6x.to (english)
Homepage:       http://www.digitalprojects.com  |   http://www.iso-top.de
iso-top.de - Die günstige Art an Linux Distributionen zu kommen
                Uptime: 10 hours 39 minutes


« previous php.smarty.general (#1422) next »