Using PHP to name a header in HTML

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
alex95
Forum Newbie
Posts: 1
Joined: Sun Aug 08, 2010 2:02 pm

Using PHP to name a header in HTML

Post 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!
JakeJ
Forum Regular
Posts: 675
Joined: Thu Dec 10, 2009 6:27 pm

Re: Using PHP to name a header in HTML

Post 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>";
Post Reply