On Mon, 20 Aug 2001, LondonVibe wrote:
> new to php so be nice :)
>
> win2k iis5.ms access..
>
> what is the order for adding var's to a access DB ??
> 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')";
Don't put single ticks around a field which holds numerical data... unless
you defined your primary ID as a text field (hope not) that's probably why
the query is bombing out.
> // 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.");
Okay, I've never written PHP to ODBC but making the same call twice and
assigning the values to different variables? One of us is confused...
> // execute SQL statement and get results
> odbc_execute($sql_result) or die("Couldn't execute statement1.");
>
> odbc_free_result($sql_result);
> odbc_close($connect);
Justin Buist
Trident Technology, Inc.
4700 60th St. SW, Suite 102
Grand Rapids, MI 49512
Ph. 616.554.2700
Fx. 616.554.3331
Mo. 616.291.2612
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]