[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 284
  • Last Modified:

php mysql

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
doctorbill
Asked:
doctorbill
  • 2
  • 2
3 Solutions
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
please use htmlentities function:
http://php.net/manual/en/function.htmlentities.php

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

Open in new window

0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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
 
doctorbillAuthor Commented:
thanks
0
 
doctorbillAuthor Commented:
solved
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now