Solved

php mysql

Posted on 2013-02-04
4
265 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
  • 2
  • 2
4 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
Comment Utility
please use htmlentities function:
http://php.net/manual/en/function.htmlentities.php

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

Open in new window

0
 
LVL 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 500 total points
Comment Utility
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
Comment Utility
thanks
0
 

Author Closing Comment

by:doctorbill
Comment Utility
solved
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
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.

728 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now