Log in

View Full Version : Bullet point question in PHP vs HTML page



lindsaycb
10-09-2009, 03:59 PM
Two pages:

http://www.kishwaukeecollege.edu/athletics/player.php?id=309

http://www.kishwaukeecollege.edu/athletics/player.shtml?id=309

The PHP doesn't show the bullet in my database field but the .shtml file does. Is there anyway to make the PHP page show the bullet point?

traq
10-10-2009, 04:28 AM
try encoding the bullet instead of entering the character directly in the code: •

post your php code if you need more help

djr33
10-10-2009, 08:43 PM
You can automatically convert characters using htmlentities() as well. (Look any function up on php.net for examples/usage).

lindsaycb
10-20-2009, 07:43 PM
You can automatically convert characters using htmlentities() as well. (Look any function up on php.net for examples/usage).

Unfortunately, this didn't help. I have a bullet point in the database just copied over from a Word document, so no special code or anything.

When I put in the HTML code for bullet, • and use the htmlentities(), it reads it as •. Without the htmlentities, it shows up as a bullet point. However, I don't want to go into my database and change the bullet point that's already in there to the HTML code. That would be a lot of work!

Is there something special or different about why a .shtml page will read this item in the database and the .php page won't?

traq
10-21-2009, 01:43 AM
... just copied over from a Word document, so no special code or anything.

That's probably your problem; maybe something to do with character encoding. Replacing the bullet with the appropriate html entity ( • ) would be your best solution.

lindsaycb
10-23-2009, 02:18 PM
That's probably your problem; maybe something to do with character encoding. Replacing the bullet with the appropriate html entity ( • ) would be your best solution.

So there must be something in the HTML render vs. PHP page rendering?

That's why in the original post, I had 2 links, one a HTML page and the other a PHP page and pulling info from the same database but the bullet shows up in the HTML page and doesn't in the PHP page. Is that correct?

traq
10-23-2009, 08:30 PM
I have no idea. I would think it might have something to do with the database and how things are encoded/decoded between there and php. After all, php is all server-side, it serves normal html to the browser.

djr33
10-24-2009, 07:14 PM
You cut and paste from word. You can use php (htmlentities, or even str_replace) to specifically fix this, or you can not use that-- not using that means you won't fix what you cut/paste from word, and you need to fix the real problem-- don't cut/paste from word.
PHP is not the problem at all, just generating html, as traq said. The encoding of the database, the html page, and the word document must match or you will end up with strange results, though, so that might be the problem (probably is).