Hello, I'm having a strange problem using an SQL SELECT statement that I've not experienced in all the times I've had to perform one before. Mabye I'm missing something because I haven't done it in a few weeks so hopefully you will see what the problem is.

Essentially I just want to do a simple SELECT WHERE post_type is equal to 'page' to create a list of URL links.


Code PHP:
function listPages() {
 
		$result = mysql_query("SELECT * FROM posts WHERE page_type='page'");
		$row = mysql_fetch_array($result);
		echo "<ul>";
		while($row = mysql_fetch_array($result)) {
				$pageID = $row['id'];
				$pageTitle = $row['title'];
 
				echo "<li><a href='" . BASE_URL . "/index.php?id=$pageID'>$pageTitle</a></li>";
			}
 
		echo "</ul>";
}

The problem is it isn't returning a post. But the PHP itself I think is sound because if I replace "page_type" with "post_author" which requests a number, it returns rows just fine.

So I thought maybe it just wasn't able to deal with how I've stored "page_type" (Varchar) but if I do "Post_id" which is itself a number, it won't return anything. So it is boggling my mind, this kind of setup worked fine in the past but it won't find a number like "post_id"?

I can only assume I'm missing something obvious because I've used this type of code fine before and it will return rows based on some items and not others, its just the first time I've had this problem and nothing obvious I can think of is working so I'm wondering if something is wrong with how I've set up the DB.

This is the "posts" DB structure.



And this is the overview. Its just a testing DB so it's not properly populated. In this specific case I'm trying to get post 80 to show up as it is the only "page"



As an aside, I have tried selecting specific columns rather than * but it doesn't make a difference.