Re: Still working on those damn "`s
| From: | Koos van den Hout | Date: | Thu, 09 Nov 2000 12:40:14 +0000 |
| Subject: | Re: Still working on those damn "`s | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-4330@lists.php.net to get a copy of this message | ||
Quoting Trond Erling Hundal who wrote on Thu, Nov 09, 2000 at 01:18:52PM +0100:
> This is the thing;
> 1. User writes an email in a textarea field named "email"
> 2. User hits a button and gets to view the email before he acctually send
> it. The input that he wrote on the last page is in a hidden field
> 3. When he clicks "send" the email will be sendt and stored in mysql.
>
> If $email = "I want to cook "alot" of chickens tonight" ;
>
> Then all that is sendt and stored of the email is "I want to cook /"....
>
> I am wondering if this is a thingy that sessions would solve???
What is the link between 'sessions' and 'storing strings in a database' ?
Anyway, the point is that a " starts a string and ends a string. So in
order to store strings that contain one or more ", you'll have to do
special things.
What I use for sybase is storing strings with '' around them and then use
the following function to convert strings from 'web input' to 'sybase
input':
function makesyb($inputline){
$inputline=stripslashes($inputline);
$inputline=ereg_replace("\'","''",$inputline);
return $inputline;
}
Maybe mysql needs quote-doubling too, or maybe you'll need to do something
different.
Koos
--
Koos van den Hout, PGP keyid RSA/1024 0xCA845CB5 via keyservers
koos@kzdoos.xs4all.nl or DSS/1024 0xF0D7C263 -?)
Fax +31-30-2817051 Visit my site about books with reviews /\\
http://idefix.net/~koos/ http://www.virtualbookcase.com/ _\_V