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

x
?
Solved

php mysql

Posted on 2013-02-04
4
Medium Priority
?
282 Views
Last Modified: 2013-02-11
I think I already know the answer to this but:

I have entries in a database such as
Drawer set 5' 3"
Headboard 3' 9"

etc ....

Yes I know that these are illegal characters (it is not my database) but my question is:
If the data is echoed in the following format:
<php echo $row_data['name']; ?>
Is it possible to escape the " and 'characters so the record is echoed onto the page. At the moment the data is not being shown. If I delete the " and ' characters then it is shown on the page
0
Comment
Question by:doctorbill
[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
4 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 38850979
please use htmlentities function:
http://php.net/manual/en/function.htmlentities.php

<php echo htmlentities($row_data['name']); ?>

Open in new window

0
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 38850980
and for the save into the database (insert/update), you would use this function to avoid sql injection and/or sql errors:
http://php.net/manual/en/function.mysql-real-escape-string.php
0
 

Assisted Solution

by:doctorbill
doctorbill earned 0 total points
ID: 38859403
thanks
0
 

Author Closing Comment

by:doctorbill
ID: 38875300
solved
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses how to implement server side field validation and display customized error messages to the client.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

609 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