Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Input/Output MySQL problem

Posted on 2007-03-27
5
Medium Priority
?
277 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:Yury Merezhkov
[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 1000 total points
ID: 18804456
try echo "<input type='text' value='".stripslashes($row["name"])."'>";
0
 
LVL 14

Assisted Solution

by:Vel Eous
Vel Eous earned 1000 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:Yury Merezhkov
ID: 18809017
That worked. Thank you very much.
0
 
LVL 7

Author Comment

by:Yury Merezhkov
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

650 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