Solved

php mysql

Posted on 2013-02-04
4
268 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 500 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 500 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

726 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