Re: A Small Bug Giving Me A Big Headache

From: Date: Mon, 04 Mar 2002 21:48:44 +0000
Subject: Re: A Small Bug Giving Me A Big Headache
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-87164@lists.php.net to get a copy of this message
OK. Is "Short" a keyword? The "Short" part in "INERT INTO Movies (Title, Actors, Review, Reviewer, Short)...." is giving me the "Syntax Error" message. I will rename my tables with a "mv" suffix. Lets see if that solves the problem. "Dr. Shim" <ultimatezzz@hotmail.com> wrote in message news:20020304214047.59478.qmail@pb1.pair.com... Matt Schroebel suggested I echo "$SQLString"; The echo statement returned INSERT INTO Movies (Title, Actors, Review, Reviewer, Short) VALUES (, , , , ,) So, clearly, the error lies in the form that passes the values to this script. Thanks Matt, we're getting closer. "Dr. Shim" <ultimatezzz@hotmail.com> wrote in message news:20020304193234.69972.qmail@pb1.pair.com... Nope, all my values are strings. "Markas" <mark@e-net.lt> wrote in message news:20020303200342.28701.qmail@pb1.pair.com... $SQLString = "INSERT INTO Movies (Title, Actors, Review, Reviewer, Short) VALUES ('$Title','$Actors','$Review','$Reviewer','$Short')"; As the manual says: Note: Unlike the two other syntaxes, variables will not be expanded when they occur in single quoted strings. ... So maybe some your fiels requires a numeric value, but because no extraction occurs, it receives string? Dr. Shim <ultimatezzz@hotmail.com> wrote in message news:20020303035921.26506.qmail@pb1.pair.com... > I did, and a rather informative error message came. I didn't know how to > debug like that. Sorry, I'm rather new to this. > > It says [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT > INTO statement. > > > > > > "Rasmus Lerdorf" <rasmus@lerdorf.ca> wrote in message > news:Pine.LNX.4.44.0203021847290.27428-100000@christine.ca... > Well, add this and tell us what it says: > > if(!$cursor) echo odbc_error($db).": ".odbc_errormsg($db); > > right after that odbc_exec() call. > > *always check for errors - and when you get one, show it!* > > -Rasmus > > On Sat, 2 Mar 2002, Dr. Shim wrote: > > > I've tried, and tried. Reread, and reread. I can't at all find out what's > > wrong with these two lines of code. > > > > $SQLString = "INSERT INTO Movies (Title, Actors, Review, Reviewer, Short) > > VALUES > > ('$Title','$Actors','$Review','$Reviewer','$Short')"; > > $cursor = odbc_exec($db, $SQLString); > > > > I have an if...then conditional statement causing echo to print out an > error > > message if the $cursor returns false. > > > > The $cursor keeps returning false. I don't know why! My $db variable > (which > > plugs into the odbc database) is fine. Those two lines have got to be the > > problem. > > > > > > Can you people help me out with this? > > > > If I have to give you my whole script (not very long) I will. > > > > Thanks for any help you can give me. > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > >

« previous php.general (#87164) next »