I've been looking at this for hours now and can't figure it out. I am trying a new way of writing my functions and now I have these strange characters appearing. Hopefully these will show for you. my function: function getAlbums() { require 'database.php'; $q = "SELECT * FROM albums ORDER BY id ASC"; $result = $mysqli->query($q) or die($mysqli_error($mysqli)); if($result) { while($row = $result->fetch_object()) { $title = $row->title; $id = $row->id; print '<li><h3><a href="album-view.php?id=' . $id . '">' . $title . '</a></h3></li>'; } } } PHP: database.php $db_server = ""; $db_user = ""; $db_pass = ""; $db_name = ""; $mysqli = new mysqli($db_server, $db_user, $db_pass, $db_name) or die(mysqli_error()); PHP: Can anyone please help me?
Type/Collation MyISAM/latin1_swedish_ci It was this by default. Dont really know what they mean, still new to all of this.
What does the data in your database look like? Screenshot? What is the exact output that you get on your page? Screenshot. The collation should work fine, or you could try changing it to utf-8 for internationalization.
Ah, that seems like it would be probably be a problem with your HTML/CSS code, not your PHP function.
That was my first thought, but when I remove the php its going away. I just uploaded all files to a sub dir on the site so you could see the live,but have some error regarding the mysqli. Is it possible that its not supported by my hosting? Her is the output source for that section of html. <div id="gallery"> <ul class="gallery"> <li><h3><a href="album-view.php?id=1">First few days</a></h3></li><li><h3><a href="album-view.php?id=2">Around the House</a></h3></li><li><h3><a href="album-view.php?id=3">Bush Gardens</a></h3></li><li><h3><a href="album-view.php?id=4">The Zoo</a></h3></li><li><h3><a href="album-view.php?id=5">tmp</a></h3></li><li><h3><a href="album-view.php?id=6">test</a></h3></li><li><h3><a href="album-view.php?id=7">test album</a></h3></li><li><h3><a href="album-view.php?id=8">test album 2</a></h3></li><li><h3><a href="album-view.php?id=9">test album 2</a></h3></li><li><h3><a href="album-view.php?id=10">test album 3</a></h3></li><li><h3><a href="album-view.php?id=11">last album test</a></h3></li> </ul> </div> <div class="" align="center"> || <a href="gallery-edit.php?task=add-album">Add an Album</a> | <a href="gallery-edit.php?task=delete-album">Delete an Album</a> | <a href="gallery-edit.php?task=add-image">Upload an Image</a> | <a href="gallery-edit.php?task=delete-image">Delete an Image</a> || </div> HTML: That symbol shows before the first li.
Hmm, it's definitely a character set issue. I found this on Google search: It probably has to do with the code editor you are using to write and save your PHP file. Are you using Notepad? Read this to get an idea how to solve the problem: http://www.killersites.com/forums/topic/265/i-bom-characters/ Hope this helps!
The forum posts you referenced stated it was a common problem with notepad and to use notepad++. I have never used notepad to code in, I use dreamweaver, but just started using notepad++ when I started this site. They said to change it at the save as operation and it didn't have that option, so I opened the files in notepad and change the type to ANSI and the BOM symbols are gone. Hopefully I wont have to do it all the time. Thanks again for you help
Glad you were able to fix it. I generally use Notepad++, Eclipse PDT or Aptana IDE for coding PHP. Never had this issue so not too sure why you did. Anyway, in Notepad++, click on Format and ensure that "Encode in ANSI" is the option selected. Hopefully that will take care of future problems!