یک مثال ساده برای تولید پیج داینامیک بوسیله لینکها و Mysql :
کد PHP:
<!---------------------------------- Change File name To links.php -------------------->
<!-- links.php -->
<a href="links.php?id=1">File 1</a>
<a href="links.php?id=2">File 2</a>
<a href="links.php?id=3">File 3</a>
<?php
// Load the database connections
include 'db.php';
//check to see if one of the links were clicked
echo '<div>';
if(isset($_GET['id'])){
// Make a safe string
$id = mysql_real_escape_string($_GET['id']);
// Query the database
$sql = mysql_query("SELECT * FROM table_name WHERE id='$id'");
if(mysql_num_rows($sql) == 1){
// If one row was found, create an array of the row
$row = mysql_fetch_array($sql);
// echo the column 'content' (change 'content' to your column name)
echo '<p>'.$row['content'].'</p>';
}else{
// Row was not found
echo '<p>File Not Found.</p>';
}
}else{
// the id parameter in the url was not set
echo '<p>Invalid URL.</p>';
}
echo '</div>';
?>