Here's the code that i've been trying to work with. I have the table set but I have no idea how to use it...like uploading the files
PHP:
<?php
$host = "localhost"; //your sql host, usually 'localhost'
$user = "........"; //username to connect to database
$pass = ".........."; //password to connect to database
$db = "......"; //the name of the database
mysql_connect($host,$user,$pass) or die("ERROR:".mysql_error());
mysql_select_db($db) or die("ERROR DB:".mysql_error());
$max = 10; //amount of articles per page. change to what to want
$p = $_GET['p'];
if(empty($p))
{
$p = 1;
}
$limits = ($p - 1) * $max;
//view the news article!
if(isset($_GET['act']) && $_GET['act'] == "view")
{
$id = $_GET['id'];
$sql = mysql_query("SELECT * FROM photo WHERE id = '$id'");
while($r = mysql_fetch_array($sql))
{
$title = $r['id'];
$story = $r['body'];
$author = $r['author'];
echo "<div><p>$title</p><p>$author</p><p>$story</p></div>";
}
}
else
{
//view all the news articles in rows
$sql = mysql_query("SELECT * FROM photo LIMIT ".$limits.",$max") or die(mysql_error());
//the total rows in the table
$totalres = mysql_result(mysql_query("SELECT COUNT(id) AS tot FROM photo"),0);
//the total number of pages (calculated result), math stuff...
$totalpages = ceil($totalres / $max);
//the table
echo "<table><tr><td>Title</td><td>Author</td></tr><tr>";
while($r = mysql_fetch_array($sql))
{
$id = $r['id'];
$title = $r['body'];
$author = $r['author'];
echo "<td><a href='test.php?act=view&id=$id'>$title</a></td><td>$author</td>";
}
//close up the table
echo "</tr></table>";
for($i = 1; $i <= $totalpages; $i++){
//this is the pagination link
echo "<a href='test.php?p=$i'>$i</a>|";
}
}
?>