Using apostrophe"s within a text field

Using apostrophe"s within a text field

am 28.03.2007 06:15:03 von Stephen Smith

------=_NextPart_000_0047_01C770CE.21BFF2B0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

OK guys, here is my delima, which is probably very easy to solve, but I =
can't seem to find it. I am trying to get form fields to accept =
apostrophes within the input and stop crashing on me. I'm writing forms =
into a mysql database and everything works great unless the user enters =
a word like "won't" or "can't". Them it crashes during the form submit. =
What can I do to fix this stupid thing anyway?

thanks in advance.

Steve Smith

------=_NextPart_000_0047_01C770CE.21BFF2B0--

Re: Using apostrophe"s within a text field

am 28.03.2007 06:27:33 von dmagick

Stephen Smith wrote:
> OK guys, here is my delima, which is probably very easy to solve, but I can't seem to find it. I am trying to get form fields to accept apostrophes within the input and stop crashing on me. I'm writing forms into a mysql database and everything works great unless the user enters a word like "won't" or "can't". Them it crashes during the form submit. What can I do to fix this stupid thing anyway?

Are you having issues displaying the data or saving it to a database?

If it's going into a database, use the appropriate escape_string
function. Eg mysql_real_escape_string (php.net/mysql_real_escape_string)
or pg_escape_string (php.net/pg_escape_string) or as a last resort
addslashes (php.net/addslashes)

When you display the data back, use htmlspecialchars or htmlentities.


Read http://phpsec.org/projects/guide/3.html for more info.

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Using apostrophe"s within a text field

am 28.03.2007 07:36:33 von Ron Croonenberg

There is that mysql function that is meant for prevention of sql injection

when a single quote or so is entered sql starts acting up. because the
sql syntax is not correct anymore. then your sql functions start acting
up and you get to see all those informative msgs

Turning a ' into a '' or a " into a "" works too, but the mysql
function for that works better safer etc.


Ron


Stephen Smith wrote:
> OK guys, here is my delima, which is probably very easy to solve, but I can't seem to find it. I am trying to get form fields to accept apostrophes within the input and stop crashing on me. I'm writing forms into a mysql database and everything works great unless the user enters a word like "won't" or "can't". Them it crashes during the form submit. What can I do to fix this stupid thing anyway?
>
> thanks in advance.
>
> Steve Smith
>

--
============================================================ =====
It's is not, it isn't ain't, and it's it's, not its, if you mean
it is. If you don't, it's its. Then too, it's hers. It isn't
her's. It isn't our's either. It's ours, and likewise yours and
theirs.
-- Oxford Uni Press
============================================================ =====
Ron Croonenberg |
| Phone: 1 765 658 4761
Lab Instructor & | Fax: 1 765 658 4732
Technology Coordinator |
|
Department of Computer Science | e-mail: ronc@DePauw.edu
DePauw University |
275 Julian Science & Math Center |
602 South College Ave. |
Greencastle, IN 46135 |
============================================================ =====
http://www.csc.depauw.edu/RonCroonenberg.html
============================================================ =====

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Using apostrophe"s within a text field

am 28.03.2007 08:53:00 von robleyd

Stephen Smith wrote:

> OK guys, here is my delima, which is probably very easy to solve, but I
> can't seem to find it. I am trying to get form fields to accept
> apostrophes within the input and stop crashing on me. I'm writing forms
> into a mysql database and everything works great unless the user enters a
> word like "won't" or "can't". Them it crashes during the form submit.
> What can I do to fix this stupid thing anyway?
>
> thanks in advance.
>
> Steve Smith

http://php.net/mysql_real_escape_string

The manual is your friend.


Cheers
--
David Robley

I'm Serfectly Pober.
Today is Boomtime, the 14th day of Discord in the YOLD 3173.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: Using apostrophe"s within a text field

am 28.03.2007 13:18:16 von Bastien Koert

use

mysql_real_escape_string($_POST['field'] IN the query
use addslashes
use htmlspecialentities
use str_replace to switch it to an ascii equivalent

hth

bastien


>From: "Stephen Smith"
>To:
>Subject: [PHP-DB] Using apostrophe's within a text field
>Date: Wed, 28 Mar 2007 00:15:03 -0400
>
>OK guys, here is my delima, which is probably very easy to solve, but I
>can't seem to find it. I am trying to get form fields to accept
>apostrophes within the input and stop crashing on me. I'm writing forms
>into a mysql database and everything works great unless the user enters a
>word like "won't" or "can't". Them it crashes during the form submit.
>What can I do to fix this stupid thing anyway?
>
>thanks in advance.
>
>Steve Smith

____________________________________________________________ _____
http://local.live.com/?mkt=en-ca/?v=2&cid=A6D6BDB4586E357F!4 20

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php