How do i make it dynamic I dont want 20 000 pages of data?

Dodgyknacker

Solid State Member
Messages
6
I havent really got a clue what im doing so i need some help I am tryig to create a site with news on it the problem im having is that on my index.php isbring up the headlines with a section of content $leader fine but how do i create a link from the $headline to the same page (dynamic) but only showing the headline and full content of the headline clicked on.

I cant get my pages to be dynamic which is the whole idea of using mysql and php so please teach me or send me to some decent tutorials the manual on php.net is to technical it doesnt explain anything and the other tutorials out there are to simple they dont get into the complex stuff.

here is the code


<?
include("inf.php");

mysql_connect($hostname,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM ($tablename)";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();

$i=0;
while ($i < $num) {
$id=mysql_result($result,$i,"id");
$datetime=mysql_result($result,$i,"datetime");
$subject=mysql_result($result,$i,"subject");
$headline=mysql_result($result,$i,"headline");
$leader=mysql_result($result,$i,"leader");
$content=mysql_result($result,$i,"content");
?>

<!-- Begin #main -->
<div id="main">
<div id="main2">
<div id="main3">
<h2 class="date-header">
<? include("site/includes/time.php"); ?>
</h2>
<div class="post">
<h3 class="post-title">

<!-- On the main index.php page I want 5 headlines and then I want the headline to link to this same (dynamic) page but with the variable $content also showing and the other four headlines no longer showing -->

<a href="Article alone page" title="permanent link"><? echo "$headline"; ?>
</a> - posted on <? echo "$datetime"; ?></h3>
<div class="post-body">
<p>
<b><? echo "$leader"; ?></b>

</p>
</div>
</div>
<div class="post">
<div>
<br />
</div>
</div>
</div></div></div>
<!-- End #main -->

<?
++$i;
}
?>
 
Back
Top Bottom