Re: Problem with Insert with ODBC
| From: | Radovan Radic | Date: | Tue, 01 Jul 2003 14:05:57 +0000 |
| Subject: | Re: Problem with Insert with ODBC | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-20639@lists.php.net to get a copy of this message | ||
Try this:
odbc_error
Get the last error code (PHP 4 >= 4.0.5)
string odbc_error ( [resource connection_id] )
"Veselina Jecheva" <vessi@bfu.bg> wrote in message
news:3.0.6.32.20030701120809.0079c530@mx.bfu.bg...
> How can I do this - odbc_exec returns just false on error?
>
> At 16:41 6/30/03 +0200, Svensson, B.A.T. (HKG) wrote:
> >You ought to test for an error in your "error detection"
> >not for an return value on the execute of an SQL query.
> >
> >> -----Original Message-----
> >> From: Veselina Jecheva [mailto:vessi@bfu.bg]
> >> Sent: Monday, June 30, 2003 3:19 PM
> >> To: php-windows@lists.php.net
> >> Subject: [PHP-WIN] Problem with Insert with ODBC
> >>
> >>
> >> Hello,
> >> I've got the following problem: the following line prints "Error" all
the
> >> time:
> >>
> >> $link = odbc_connect("conference","","");
> >> $query="insert into participants (name, surname, family, degree,
> >> work_place, speaker, listener, topic, title,
> >> co_author, aspekt, comp, proektor, video, date15, date16,
date17,
> >> fee)
> >> values ('$name', '$surname', '$family',
> >> '$degree', '$work_place',
> >> '$speaker', '$listener', '$topic', '$title',
> >> '$co_author', '$asp', '$computer', '$proekt',
> >> '$video', '$date15',
> >> '$date16', '$date17', '$fee')";
> >> $result=odbc_exec($link,$query);
> >> if ($result) echo "Thank you, your request has been processed.";
> >> else echo "Error";
> >>
> >> The database is created by Access, all variables are defined and have
their
> >> values. It seems the SQL statement is not ok.
> >> Thank's in advance.
> >> Veselina
> >>
> >>
> >> --
> >> PHP Windows Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >
>