RE: [PHP-WIN] simple odbc/insert problem

From: Date: Mon, 20 Aug 2001 15:43:26 +0000
Subject: RE: [PHP-WIN] simple odbc/insert problem
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-8957@lists.php.net to get a copy of this message
> thx erik... i missed the first one (comment)... still get > error... Couldn't > execute statement1 .... third not sure on the odbc_exec.. OK, I must be brain dead this morning. ;) ----- original code ----- // connect to system dsn odbc name login and password or die $connect = odbc_connect("DB","name","pword") or die (" not connected"); $sql="INSERT INTO basket (Item,Amount,Price) Values('$id','$amount','$price')"; // prepare SQL statement //$sql_prepare = odbc_prepare($connect,$sql) or die("Couldn't prepare query."); // prepare SQL statement $sql_result = odbc_prepare($connect,$sql) or die("Couldn't prepare query."); // execute SQL statement and get results odbc_execute($sql_result) or die("Couldn't execute statement1."); odbc_free_result($sql_result); odbc_close($connect); ----- end original code ----- 1.) Kill the first or the second sql_prepare. They're the same thing and are therefore redundant. 2.) I'm not all that sure if your die() statements mean a whole lot in this instance. The way I read it, the odbc driver errors will supercede the die(). Someone correct me if I'm wrong. :) 3.) What's the EXACT syntax of the error(s) you're receieving? Copy and paste it into the e-mail, along with the variable values being submitted by the form. To make that easier, toss in: print("values: '$id','$amount','$price'\r\n<br>\r\n"); at the top of your code. That way it'll be easier for the list members to tell what's a happenin' over there. - Erik

« previous php.windows (#8957) next »