I call upon my MySQL database to post the name of a category in the title tag in band_cat_list.php. This is the code for adding it into the title:
BAND_CAT_LIST.PHP
<head>
<?php
include ('database.php');
$get_title = "SELECT * FROM `Categories`";
$run_title = mysql_query($get_title);
while ($row_title = mysql_fetch_array($run_title)){
$cat_id = $row_title['cat_id'];
$cat_title = $row_title['cat_title'];
echo "<title>Offstreams - $cat_title</title>";
}
?>
</head>
Inside index.php, I post the categories. The Categories display no problem and when I click on them they go to the appropriate page which is "index.php?band_cat_list&cat=$category_id"
INDEX.PHP
<div class="header_links">
<ul class="header_ul">
<?php
include("includes/database.php");
$get_categories = "select * from Categories";
$run_categories = mysql_query($get_categories);
if (!$run_categories) { // add this check.
die('Invalid query: ' . mysql_error());
}
while ($category_row=mysql_fetch_array($run_categories)){
$category_id = $category_row['cat_id'];
$category_title = $category_row['cat_title'];
echo "<li class='header_li' align='center'><a href='index.php?band_cat_list&cat=$category_id'>$category_title</a></li>";
}
?>
</ul>
</div>
I am running PHP 5.4 on my server, so I know the function mysql_fetch_array() isn't deprecated.But I can't figure it out. When I click on any of the categories, it only posts the first one on the list in the title tag. Please help.