simple odbc insert problem
| From: | LondonVibe | Date: | Mon, 20 Aug 2001 15:11:13 +0000 |
| Subject: | simple odbc insert problem | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-11569@lists.php.net to get a copy of this message | ||
new to php so be nice :)
win2k.... iis5.....ms access..
what is the order for adding var's to a access DB ??
i can read data form the DB ok.. even print it out in a nice table :)... but
not sure how i write to the DB... it's driving me mad... any help or faq's
would be cool...
thx
Jello
code i tried... with data from form don't work...
// 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);