Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Displaying quotes when pulling from a database

Featured Replies

Hi all,

 

More php questions from me :)

 

Basically I have this code:

 

<div id="content">
 <h1><?php echo $row_ProductDetail['title']; ?>  </h1>
 <p><?php echo nl2br($row_ProductDetail['copy']); ?></p>
<p><a href="logged-in.php" class="intext">Click here to return to the customer section</a></p>
</div>

 

to display my products detail - the nl2br() function works perfectly for the user to be able to just put line breaks in, but when they add in quote marks they end up as these weird little white-out-of-black question marks in a diamond (i hope that makes sense)

 

EDIT: ����� these things...

 

So is there an easy way to make the quotes display as quotes?

 

Help me please :p

 

Cheers

Have you checked the HTML source for the page rather than just the browser's rendering? I sometimes get this on Linux when the font doesn't have the required glyphs (or for some reason the browser can't interpret those glyphs correctly). My guess would be that the source is okay, and if you changed font (or even browser/operating system), it'd be fine. That's only a guess though :D

  • Author

Well the Glyphs are in the source code too - so it appears to be happening when it is pulling in from the DB to the HTML - because in phpMyAdmin they look fine :)

 

Any ideas?

 

Cheers

  • Author

UTF-8

 

I always just use the default one from DW really :s :)

 

Cheers

  • Author

Thanks for that Sumeet - but I know how to do that - the client however, doesn't and they will be entering stuff into the database... so giving them an ASCII table to memorize and getting them to replace characters will not help at all...

 

other ideas of how to do this with PHP/MySQL are much appreciated :)

You mentioned that it displays fine in phpMyAdmin... so the real question is, what is the difference between that and your site? Does it do entity replacement on funny characters? Is it using a different font?

 

I'd try to narrow down exactly what the difference is to move forward with a solution. Other possible ideas: the character encoding in the submitted form doesn't match that of the database or that of the final display page, so a few odd characters are being mangled (ISO-8859-1 is a superset of UTF-8 and generally a good choice because it holds many additional common symbols like the £ pound sterling sign); it could be that the browser is using angled quote marks on submission or display, and the font does not support these.

 

Either way, what is the actual data in the database table? Does it actually use straight quote marks, or is it holding angled ones which have a different Unicode glyph value? Just some ideas there.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.