RE: [PHP-WIN] ODBC: SQL insert problem
| From: | Budgee) | Date: | Wed, 11 Oct 2000 13:07:42 +0000 |
| Subject: | RE: [PHP-WIN] ODBC: SQL insert problem | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-3149@lists.php.net to get a copy of this message | ||
Thanks - works fine.
I have a problem with the text area section...
If a ' comes up in the text area, the insert bombs out with the
following message:
Thanks
<?
$conn=odbc_connect("glenwood","","");
if ($submit) {
$sql="insert into headmaster (title, [date], comment) values ('$title',
'$date', '$comment')";
$result = odbc_exec($conn,$sql);
} else {
?>
<form method="post" action="<?echo $PHP_SELF;?>">
<table>
<tr><td>Title: </td><td><input type="text"
name="title" size="40"></td></tr>
<tr><td>Date: </td><td><input type="text"
name="date"> MM/DD/YY</td></tr>
<tr><td> </td><td><textarea name="comment"
cols="50" rows="10"></textarea></tr>
<tr><td><input type="submit"
name="submit"></td></tr>
</tr>
</table>
</form>
<?
}
odbc_close ($conn);
?>
Cheers
Warwick Chapman (1999)
Assistant IT Manager
Glenwood High School, Durban, South Africa
031 2055241
083 7797094
www.glenwoodhighschool.co.za