I know there are a lot of tutorials out there. but somehow i can't fully grasp them.
Here is what i need to do.
I have a database. and I can display the records that i needed to fetch on my page
but the way i wanted them to display is by formatting them in a 3x2 table.
which means i have to limit my item display to 6 per page.
i tried my hand on paging first. i was able to page it with the correct limit of 6 items per page. HOWEVER, if i got to the next pages, they all display the same items seen on page 1.
i know it's just a matter of logic. but i'm just about ready to give up for today. i hope somebody could help me.
this is my code without the paging and the formatting to tables.
[FONT=Trebuchet MS]<?php
include ('config.php');
/ variable declaration /
$month = date ('F');
$day = date ('d');
$year = date ('Y');
$endday= $day + 7;
$items=4;
$connection = @mysql_connect($dbhost, $dbuser, $dbpass) or die ("couldn't connect");
mysql_select_db($dbname) or die ("could not open database");
$query="SELECT id, author, title, month, day, year, location, desc1, booksite FROM events WHERE (month LIKE '$month' AND day >= '$day' AND day <= '$endday' AND year LIKE '$year') ORDER BY month, day, year";
$result=mysql_query($query) or die("Error in query: $query. " . mysql_error());
if (mysql_num_rows($result)>0)
{
while ($row = mysql_fetch_object($result))
{
?>
<a href="detailed.php?id=<?php echo $row->id; ?>"><?php echo $row->author; ?></a><br /><?php echo $row->title; ?><br />
<?php echo $row->month; echo " "; echo $row->day; echo", "; echo $row->year; ?><br /><?php echo $row->desc1; ?><br /><a href="<?php echo $row->booksite; ?>"><?php echo $row->booksite; ?></a><br />
<a href="edit_events.php?id=<?php echo $row->id; ?>">Edit</a> | <a href="delete_events.php?id=<?php echo $row->id; ?>">Delete</a><br /><br />
<?php
}
}
else
{
echo 'No records found';
}
mysql_close($connection);
?>[/FONT]