I have a web page with a simple introductory paragraph on it. I was
going
to
store the paragraph in a mySQL DB and create an administration page so
people could easily edit the paragraph itself or change it all
together.
The
problem I ran into is that mySQL will not allow certain punctuation
it gives me errors. I take
them out of the sql text and webpage and it works fine.
From: John W. Holmes [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: 'Tyler Durdin' [EMAIL PROTECTED],[EMAIL PROTECTED]
Subject: RE: [PHP] updating pages with php
Date: Wed, 5 Mar 2003 13:23:00 -0500
I have a web
The problem I ran into is that mySQL will not allow certain punctuation
inside of a record (no comma's). So now I am left trying to figure out how I
can have the user update the paragraph without having it in a db. Can
someone shoot me in the proper direction? Thanks in advance, your help is
What I have discovered is that I can manually type it in the mysql server
with whatever characters I want, but when I try to update it with a sql
file
or via the webpage I created with the comma's it gives me errors. I take
them out of the sql text and webpage and it works fine.
The problem
$Query = UPDATE $TableName SET Intro_Title = '$Intro_Title', Intro =
'$Intro' WHERE ID = '$ID';
From: Liam Gibbs [EMAIL PROTECTED]
To: php list [EMAIL PROTECTED]
Subject: Re: [PHP] updating pages with php
Date: Wed, 5 Mar 2003 13:33:11 -0500
What I have discovered is that I can manually
$Query = UPDATE $TableName SET Intro_Title = '$Intro_Title', Intro =
'$Intro' WHERE ID = '$ID';
But what's being sent to SQL? What's contained in $TableName, $Intro_Title,
etc.? And what data types are all those fields?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
list [EMAIL PROTECTED]
Subject: Re: [PHP] updating pages with php
Date: Wed, 5 Mar 2003 13:44:40 -0500
$Query = UPDATE $TableName SET Intro_Title = '$Intro_Title', Intro =
'$Intro' WHERE ID = '$ID';
But what's being sent to SQL? What's contained in $TableName, $Intro_Title,
etc.? And what data
Before you save the paragraph into the db, use the addslashes() function
like this:
$textVar = addslashes($textVar);
That escapes all the characters like commas, return and whatever else
MySQL may have trouble with. The reverse the process before you display
it:
nl2br(stripslashes($textVar))
You are correct and it is apostophe's and not comma's that cause the
error. What do I do to get around that?
Escape them by putting a slash in front of them. If you have a line of text
that says 'This is the problem area I don't want to screw up', put 'This is
the problem area I don\'t want to
9 matches
Mail list logo