Page 1 of 1

Using PHP to name a header in HTML

Posted: Sun Aug 08, 2010 2:23 pm
by alex95
Hi guys!

I'm new to the forum so sorry if I posted wrong ;).

I've been looking around for a while and can't really find any help. So what I have is a normal HTML page. What I want to do is use PHP to name a header in the page. But the header must be loaded this way from a MySQL database. I want it so that the title is determined by the url. for example, if the url of the current page the browser was on was 'http://www.mysite.com/index.php' then it would find 'http://www.mysite.com/index.php' then look in the title column of the database to determine the name of the header.
The original HTML code is..
<center>
<p>This is the video title</p>
</center>
which obviously isnt much.. but you get my point.
It would be greatly appreciated if somebody could help me out!
Thanks!

Re: Using PHP to name a header in HTML

Posted: Sun Aug 08, 2010 4:00 pm
by JakeJ
Try this as an example:

Code: Select all

$qry = mysql_query("SELECT header from table where url='index.php'");
$result = mysql_fetch_assoc($qry);
echo "<header>".$result['header']."</header>";