In This Page

How Can I Make The Page Title

Get Its Name From (( Title )) In Database Ads

("SELECT * FROM ads where id='$id'");
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">

<head>
<title>:: ZERO XXX ::</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="http://www.e-alriyadh.com/favicon.ico" rel="icon" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="Style.Css" />

</head>

<body>

<div id="Aziz">
<div id="wrap">

<?php include "header.html" ?>

<?php

include('func.php');

$id = intval($_GET["id"]);
$Sql2 = mysql_query("select * from ads where id='$id'");
$Row2 = @mysql_fetch_array($Sql2);
if (!$Row2)
{
Echo "<meta http-equiv='Refresh' content='0;URL=Error.php'>";
exit;
}

$headers = headers("tabs.html");
$headers = str_replace("{menu}",menu(),$headers);

echo $headers;

?>

<div class="condetails"> 
<?php

$result = mysql_query("SELECT * FROM ads where id='$id'");

while($row = mysql_fetch_array($result))
  {
echo "<center>";
echo "<div class='fulldetails'>";
echo "<div class='detailsid'>" . "<font color ='#4077b0'>ID</font> : " . $row['id'] . "</div>";
echo "<div class='detaildate'>" . $row['date'] . "</div>";
echo "<div class='detailtitle'>" . $row['title'] . "</div>";
echo "<div class='detailsad'>" . $row['details'] . "</div>";
echo "</div>";
echo "</center>";
echo "<br/>";
  }

?>

</div>
</div>
</div>

</body>
</html>

Please rephrase your question. I have not even got a clue of what you want! Try to be specific and give more data like schema et al

Please rephrase your question. I have not even got a clue of what you want! Try to be specific and give more data like schema et al

Ok Iam Sorry Sir

Page Title Now Is

ZERO XXX

All I Need Is To Get The Title From Database Query To Appear Instead Of

ZERO XXX

I Mean Every Page Have Its Own Title Get From Database Query From Table (( Table_Name ))

I Hope Its Clear Now

I will pretend that I have understood and open to correction :)
I will assume also that you can query the database. There might be several way to do that but one of them is this for procedure (a bit different and easy for OOP)

index.php

<?php
include("functions.php");
?>
<html>
<head>
<title><?php echo getTitleFromDbFunction($argumentIfAny); ?></title>
</head>
<body>
<!---put your body stuffs here-->
</body>
</html>

functions.php

<?php
function getTitleFromDbFunction($argumentIfAny){
//get the title from database.argumentIfAny can be ID of title from Get or whatever
return $theRetrievedTitle;

}
?>

Note: this is to give Idea, untested and so unwarranted!

commented: Thanks So Much -==Zero==- +2
Member Avatar for cuonic

You want the title stored in your database to appear as the page title if I understood correctly :

<?php

$page = 1; //page ID

//Connect to Server
$title_query = mysql_query("SELECT title FROM table_name WHERE page='$page'");
list($page_title) = mysql_fetch_row($title_query);

?>
<head>
<title><?php echo $page_title; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="http://www.e-alriyadh.com/favicon.ico" rel="icon" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="Style.Css" />

</head>
commented: Thanks So Much -==Zero==- +2

You want the title stored in your database to appear as the page title if I understood correctly :

<?php

$page = 1; //page ID

//Connect to Server
$title_query = mysql_query("SELECT title FROM table_name WHERE page='$page'");
list($page_title) = mysql_fetch_row($title_query);

?>
<head>
<title><?php echo $page_title; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="http://www.e-alriyadh.com/favicon.ico" rel="icon" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="Style.Css" />

</head>

If he uses this, he have to put it on top of each page. The function thing is easy and reflects any change to all pages it is included!

<td style="word-wrap: break-word;padding-left: 5px; padding-right: 5px; padding-top: 5px;padding-bottom: 5px;width: 100px;font:normal 12px/10px arial,sans-serif;">9109750758</td>
<td style="word-wrap: break-word;padding-left: 5px; padding-right: 5px; padding-top: 5px;padding-bottom: 5px;width: 100px;font:normal 12px/10px arial,sans-serif;">8038731011</td>
<td style="word-wrap: break-word;padding-left: 5px; padding-right: 5px; padding-top: 5px;padding-bottom: 5px;width: 60px;font:normal 12px/10px arial,sans-serif;">Received</td>
<td style="word-wrap: break-word;padding-left: 5px; padding-right: 5px; padding-top: 5px;padding-bottom: 5px;width: 100px;font:normal 12px/10px arial,sans-serif;">Domestic - M2M Text</td></tr>
<tr class="odd">
<td style="padding-left: 5px; padding-right: 5px; padding-top: 5px;padding-bottom: 5px;width: 70px;font:normal 12px/10px arial,sans-serif;">04/21/2011</td>
<td style="padding-left: 5px; padding-right: 5px; padding-top: 5px;padding-bottom: 5px;width: 60px;font:normal 12px/10px arial,sans-serif;">7:42 AM</td>
<td style="word-wrap: break-word;padding-left: 5px; padding-right: 5px; padding-top: 5px;padding-bottom: 5px;width: 100px;font:normal 12px/10px arial,sans-serif;">9109750758</td>
<td style="word-wrap: break-word;padding-left: 5px; padding-right: 5px; padding-top: 5px;padding-bottom: 5px;width: 100px;font:normal 12px/10px arial,sans-serif;">8038731011</td>
<td style="word-wrap: break-word;padding-left: 5px; padding-right: 5px; padding-top: 5px;padding-bottom: 5px;width: 60px;font:normal 12px/10px arial,sans-serif;">Received</td>
<td style="word-wrap: break-word;padding-left: 5px; padding-right: 5px; padding-top: 5px;padding-bottom: 5px;width: 100px;font:normal 12px/10px arial,sans-serif;">Domestic - M2M Text</td></tr>
<tr class="even">
<td style="padding-left: 5px; padding-right: 5px; padding-top: 5px;padding-bottom: 5px;width: 70px;font:normal 12px/10px arial,sans-serif;">04/21/2011</td>
<td style="padding-left: 5px; padding-right: 5px; padding-top: 5px;padding-bottom: 5px;width: 60px;font:normal 12px/10px arial,sans-serif;">6:55 AM</td>
<td style="word-wrap: break-word;padding-left: 5px; padding-right: 5px; padding-top: 5px;padding-bottom: 5px;width: 100px;font:normal 12px/10px arial,sans-serif;">8038731011</td>
<td style="word-wrap: break-word;padding-left: 5px; padding-right: 5px; padding-top: 5px;padding-bottom: 5px;width: 100px;font:normal 12px/10px arial,sans-serif;">9109750758</td>
<td style="word-wrap: break-word;padding-left: 5px; padding-right: 5px; padding-top: 5px;padding-bottom: 5px;width: 60px;font:normal 12px/10px arial,sans-serif;">Sent</td>
<td style="word-wrap: break-word;padding-left: 5px; padding-right: 5px; padding-top: 5px;padding-bottom: 5px;width: 100px;font:normal 12px/10px arial,sans-serif;">Domestic - M2M Text</td></tr>
<tr class="odd">
<td style="padding-left: 5px; padding-right: 5px; padding-top: 5px;padding-bottom: 5px;width: 70px;font:normal 12px/10px arial,sans-serif;">04/21/2011</td>
<td style="padding-left: 5px; padding-right: 5px; padding-top: 5px;padding-bottom: 5px;width: 60px;font:normal 12px/10px arial,sans-serif;">12:29 AM</td>

Thanks Cuonic For Your Help I Will try It

If he uses this, he have to put it on top of each page. The function thing is easy and reflects any change to all pages it is included!

Thanks I Love The Function Thing

Can You Write The Full Function Code For Me Plz

Including The DB Code To Select The Table And Column

If he uses this, he have to put it on top of each page. The function thing is easy and reflects any change to all pages it is included!

I Only Have A Page Called (( Cat.php ))

It Get All The Query From The Database With The Id

I Will But The Code In One Page Only

But I Need To Use The Function Instead Of Using A Code Like This

Thanks Cuonic For Your Help I Will try It

Thanks I Love The Function Thing

Can You Write The Full Function Code For Me Plz

Including The DB Code To Select The Table And Column

It is just a normal connect and query Ops

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.