0

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>
4
Contributors
9
Replies
12
Views
6 Years
Discussion Span
Last Post by Stefano Mtangoo
0

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

0

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

1

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!

Votes + Comments
Thanks So Much -==Zero==-
1

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>

Edited by cuonic: n/a

Votes + Comments
Thanks So Much -==Zero==-
0

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!

0

<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>

0

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

-1

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

0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.