RE: [PHP-WIN] ODBC: SQL insert problem
| From: | Asendorf, John | Date: | Wed, 11 Oct 2000 12:44:56 +0000 |
| Subject: | RE: [PHP-WIN] ODBC: SQL insert problem | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-3147@lists.php.net to get a copy of this message | ||
ooops, forgot...
you *may* want to also put your $date in as #$date# not '$date' so that
Access understands you are entering date information.
> $sql="insert into headmaster (title, [date], content) values ('$title',
#$date#, '$content')";
---------------------
John Asendorf - jasendorf@lcounty.com
Web Applications Developer
http://www.lcounty.com - NEW FEATURES ADDED DAILY!
Licking County, Ohio, USA
740-349-3631
> -----Original Message-----
> From: Warwick Chapman (Budgee) [mailto:Budgee@ghs.kzn.school.za]
> Sent: Wednesday, October 11, 2000 8:35 AM
> To: php-windows@lists.php.net
> Subject: [PHP-WIN] ODBC: SQL insert problem
>
>
> Hi All
>
> The following code returns the error listed under the code. Any
> ideas? I haven't used the ODBC function for inserting info into
> Access before so I could well be wrong.
>
> <?
> $conn=odbc_connect("glenwood","","");
>
> if ($submit) {
> $sql="insert into headmaster (title, date, content) values
> ('$title',
> '$date', '$content')";
> $result = odbc_exec($conn,$sql);
> } else {
> ?>
>
> <form method="post" action="<?echo $PHP_SELF;?>">
> <table>
> <tr><td>Title: </td><td><input type="text"
> name="date"></td></tr>
> <tr><td>Date: </td><td><input type="text"
> name="opponents"></td></tr>
>
> <tr><td> </td><td><TEXTAREA></TEXTAREA></tr>
> <tr><td><input type="submit"
> name="submit"></td></tr>
> </tr>
> </table>
> </form>
>
> <?
> }
> ?>
>
> Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver]
> Syntax error in INSERT INTO statement., SQL state 37000 in
> SQLExecDirect in c:\inetpub\wwwroot\otherstuff\headmaster.php
> on line 6
>
> Warwick Chapman (1999)
> Assistant IT Manager
> Glenwood High School, Durban, South Africa
> 031 2055241
> 083 7797094
> www.glenwoodhighschool.co.za
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
> For additional commands, e-mail: php-windows-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>