?
Solved

Input/Output MySQL problem

Posted on 2007-03-27
5
Medium Priority
?
279 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
  • 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month17 days, 10 hours left to enroll

830 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