Hello. This is my functions.php : <?php $db = mysql_connect('localhost', 'root', ''); mysql_select_db('wl_db', $db); $page = $_SERVER['REQUEST_URI']; $Rez = mysql_query("SELECT * FROM `list` order by id "); while($row = mysql_fetch_assoc($Rez)) { if($page == '/' or $page == '/index.php' or $page == '/contact.php' or $page == '/blog.php' or $page == '/cf.php' or $page == '/links.php') { $title = 'titlu'; $keywords = 'key'; $description = 'desc';} elseif(!empty($_GET['id'])) { $title = $row['id']; $keywords =$row['id']; $description =$row['id']; } } ?> PHP: and this is a part of header.php : <title><?php echo $title ?></title> <meta name="keywords" content="<?php echo $keywords ?>" /> <meta name="description" content="<?php echo $description ?>" /> PHP: The problem is that every page with an id (index.php?id=1 ... to 32 max) , i get the same $title=32. Forget about $keywords and $description . I have to mention that i put $row['id'] everywhere, only to check if the script is functioning. And 32 is the number of id's that i have in the data base.
Well, it seems that your conditions are not matching your desired result. If you're getting $title=32, its because you're selecting * and the last number in the loop is the last id (32)... Your first if() ... by reading that it says if $page=(any of these) then assign a static value elseif() is looking for a $_GET which means you're posting a form, right? If not, change to $_REQUEST... I would change it all to something like: <? $pages[]="/"; $pages[]="/index.php"; $pages[]="/contact.php"; while($row=mysql_fetch_assoc($Rez)) { if($_REQUEST['id'] == $row['id']) { $title=$row['title']; $description=$row['desc']; //etc... } elseif(in_array($page,$pages)) { $title="static value"; $description="static value"; } } ?> PHP: