Re: I`m not able to store "`s in mySQL!!!!
| From: | Andy Wallace | Date: | Thu, 09 Nov 2000 10:33:22 +0000 |
| Subject: | Re: I`m not able to store "`s in mySQL!!!! | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-4327@lists.php.net to get a copy of this message | ||
> At 11:14 AM +0100 11-08-2000, Trond Erling Hundal wrote:
> >Hi
> >I`m trying to store some info that the user puts in a textarea field, but
> >when I try to insert it into the table, MySQL only stores everything up
> >until it hits on a "...
> >I tried to use addslashes($info) before i stored it in the db, but that
> >didn`t help either...
> >Any ideas??? What am I not seeing here??
>
I don't know - it works for me! Here's a sample of code I use to insert a
textarea into a mySQL database:
...
<form>
....
<td width="32%" valign=top><font
face="Arial">About:</font></td>
<td width="68%"><textarea rows=6 name=about cols=50></textarea>
</td>
</tr>
</table>
<input type=submit name=submit value="Submit">
</form>
$result=mysql_query("INSERT INTO printer (name, driver, description, about)
VALUES (\"$pname\", \"$drvname\", \"$desc\",
\"$about\")", $db);
Some of the 'about' fields have quotes and double quotes in them, and these
are stored fine in the database (the about field is of type text rather than
varchar - I don't know if that's what makes the difference).