Solved

php mysql

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Suggested Solutions

Title # Comments Views Activity
two ways encryption with php 3 37
Checkout Page Input Field not aligned 1 26
PHP Syntax Error 4 32
Number of reviews not counting correctly 2 22
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

840 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