Jump to content


Escape characters


4 replies to this topic

#1 Dat

    Young Padawan

  • Members
  • Pip
  • 55 posts
  • Gender:Male

Posted 29 August 2007 - 03:20 PM

Right now I created a working basic form that will input data into my database once I click submit. But when I look in my database through PHPmyadmin. it shows escape characters and I don't want that. How do I input data without the escape characters.

\"Look at me\" by YURIA


#2 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 970 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 29 August 2007 - 08:09 PM

Exactly where does it show those?

If you pull them out of the database and display them with PHP or from command prompt, do they still show?

If they are there already, you may have to manually remove them and place them back in (or automate the task with some str_replace()... kind of risky with large data though), and make sure when you are entering the data through PHP, to use the correct method, so as to not 'double-escape' anything.

#3 Dat

    Young Padawan

  • Members
  • Pip
  • 55 posts
  • Gender:Male

Posted 29 August 2007 - 10:27 PM

View PostDemonslay, on Aug 29 2007, 06:09 PM, said:

Exactly where does it show those?

If you pull them out of the database and display them with PHP or from command prompt, do they still show?

If they are there already, you may have to manually remove them and place them back in (or automate the task with some str_replace()... kind of risky with large data though), and make sure when you are entering the data through PHP, to use the correct method, so as to not 'double-escape' anything.
I am making a front-or w/e form, so other people besides me can add entries. I already have a database with data without escape characters. My site!

When I echo this out like...so for example:

if (!isset($_POST['submit'])) {

} else {
$title = mysql_real_escape_string( $_POST['title'] );
mysql_query( "INSERT INTO `anime_reviews` (`title`) VALUES ($title)")
echo $title

it come out as \\\"Another\\\" add for testing
Then when I look at it in my database via PHPmyadmin i see \"Another\" add for testing

So I think it's php: something to do with $_POST perhaps?

Edited by Dat, 29 August 2007 - 10:28 PM.


#4 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 29 August 2007 - 11:08 PM

Your logic seems a little flawed to me, that or you stripped some code.
if(!isset(...)){

}else{

// Is the same as...
if(isset(...)){

}
Anywho, you probably have magic quotes enabled.

#5 Dat

    Young Padawan

  • Members
  • Pip
  • 55 posts
  • Gender:Male

Posted 29 August 2007 - 11:35 PM

View Postrc69, on Aug 29 2007, 09:08 PM, said:

Your logic seems a little flawed to me, that or you stripped some code.
if(!isset(...)){

}else{

// Is the same as...
if(isset(...)){

}
Anywho, you probably have magic quotes enabled.

Well it did make a difference when I tested it ! with: Works. Without ! doesn't.

I solved this problem using stripslashes() Thank you.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users