Solved

Input/Output MySQL problem

Posted on 2007-03-27
5
271 Views
Last Modified: 2007-03-28
Hi guys,

I'm storing values in mysql database like this:

mysql_query("UPDATE galleriesList SET name = '".mysql_real_escape_string($galleryspecs[$j][1])."'  WHERE id = '".$galleryspecs[$j][0]."'") or die(mysql_error());

So for example if I put in Te'st it shows up in database as Te\'st. Then I get value from database and put it in input:

echo "<input type='text' value='".$row["name"]."'>";

I want to get Te'st in input but all I get is just Te\
What can be the problem? Thank you.
0
Comment
Question by:RealSnaD
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 20

Accepted Solution

by:
steelseth12 earned 250 total points
ID: 18804456
try echo "<input type='text' value='".stripslashes($row["name"])."'>";
0
 
LVL 14

Assisted Solution

by:Vel Eous
Vel Eous earned 250 total points
ID: 18804606
It appears to have something to do with the single apostraphie.

if you place similar code inside:

<html>
<input type="text" value="<?PHP echo stripslashes("it\'s a winner"); ?>" />
</html>

You get "it's a winner", yet if you use single quote:

<html>
<input type="text" value="<?PHP echo stripslashes('it\'s a winner'); ?>" />
</html>

You get "it".

My suggestion is perhaps just use standard HTML for your form.
0
 
LVL 14

Expert Comment

by:Vel Eous
ID: 18804610
Woops,

<input type="text" value="<?PHP echo stripslashes('it\'s a winner'); ?>" />

should be

<input type="text" value='<?PHP echo stripslashes("it\'s a winner"); ?>' />

in the above example
0
 
LVL 7

Author Comment

by:RealSnaD
ID: 18809017
That worked. Thank you very much.
0
 
LVL 7

Author Comment

by:RealSnaD
ID: 18809036
I'm going to split points because just stripslashes wouldn't do me any good. I had to replace single quotes to make it work.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question