"Erik H. Mathy" <[EMAIL PROTECTED]> wrote in message
001d01c1298a$c45958e0$1300020a@erik_laptop">news:001d01c1298a$c45958e0$1300020a@erik_laptop...
> > new to php so be nice :)
>
> Always! ;)
>
> > win2k.... iis5.....ms access..
>
> Check...
>
> > // 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);
>
> Off the top of my head, you might want to uncomment your sql_prepare
> statement.
>
> As it is:
>
> // 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.");
>
> As it should be:
>
> // 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.");
>
>
>
> Also, if that's not it...what errors are you getting, if any?
>
> Speaking for myself, I end up using odbc_exec() rather than the
combination
> of odbc_prepare()/odbc_execute(). Just a personal preference.
>
> You might want to toss in some data validation prior to the $sql
definition.
> It'll help insure you're not trying to insert bad/null values into your
> database.
>
> Hope this helps ya,
> - Erik
>
thx erik... i missed the first one (comment)... still get error... Couldn't
execute statement1 .... third not sure on the odbc_exec..
--
PHP Windows 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]