Can any of you help me fix this? No matter what when I am reading any article it will set the title to the latest article rather than the article in question. Here is my code: while($rows=mysql_fetch_array($sql_result1)) { if (isset($_GET['id']) == false) { $news_title = "Index"; } else if (isset($_GET['id']) == $rows['id']) { $news_title = $rows['title']; } } Code (markup): <title>Ali Razaqpur - News - ', $news_title, '</title> Code (markup):
$sql_query = "SELECT * FROM news_main ORDER BY cat, title DESC"; $sql_result1 = mysql_query($sql_query); Code (markup):
try $sql_query = "SELECT * FROM news_main WHERE newsitem=newsitemID ORDER BY cat, title DESC ";[/QUOTE]
Okay well I got it reading the title from the db now and it works except now it won't title the page "index" if it is in the main area. $newsitem = $_GET['id']; $sql_query1 = "SELECT * FROM news_main WHERE '$newsitem'=id ORDER BY cat, title DESC"; $sql_result1 = mysql_query($sql_query1); while($rows=mysql_fetch_array($sql_result1)) { if (isset($_GET['id']) == $rows['id']) { $news_title = $rows['title']; } else { $news_title = "Index"; } } Code (markup):
Yep, your code should be replaced with: if (isset($_GET['id']) && $_GET['id'] == $rows['id']) PHP: or simply if ($_GET['id'] == $rows['id']) PHP: