php-db | 2001071
Date: 07/12/01
- Next message: Matthew Loff: "RE: [PHP-DB] Need a shopping cart"
- Previous message: Tom Peck: "Re: [PHP-DB] pulling my hair out"
- Next in thread: Dobromir Velev: "Re: [PHP-DB] Paging help needed :-("
- Maybe reply: Dobromir Velev: "Re: [PHP-DB] Paging help needed :-("
- Reply: Roger Ramirez: "Re: [PHP-DB] Paging help needed :-("
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi there Everyone,
I currently have a dedicated Apache server with PHP 4.06, MySQL etc .. installed and running fine. Below is alittle peice of code that I would love an answer to:
<?php
$connection = mysql_connect("Localhost","username!!!","password!!!") or die("Couldn't make a connection.");
$db = mysql_select_db("planet", $connection)
or die("Couldn't select database.");
$sql = "SELECT id, email, name, subject, url, image2, comments, dat
FROM users
ORDER BY id DESC";
$sql_result = mysql_query($sql,$connection)
or die("Couldn't execute query.");
?>
<?
while ($row = mysql_fetch_array($sql_result)) {
$email = $row["email"];
$name = $row["name"];
$subject = $row["subject"];
$url = $row["url"];
$image2 = $row["image2"];
$comments = $row["comments"];
$dat = $row["dat"];
$comments=nl2br($comments);
include("censorguestbook.php");
$ip = getenv ("REMOTE_ADDR");
?>
then all the HTML and display bits (Example at www.planetoxygene.com in the guestbook).
<?
}
mysql_free_result($sql_result);
mysql_close($connection);
?>
Now my question is, how do I do paging in PHP? I need to display 10 entries per page, and be able to go back and forth with them. I'm relatively new to PHP so I would be really grateful for any advice.
Thanks everyone, I appreciate it.
Chris Payne
www.planetoxygene.com
- Next message: Matthew Loff: "RE: [PHP-DB] Need a shopping cart"
- Previous message: Tom Peck: "Re: [PHP-DB] pulling my hair out"
- Next in thread: Dobromir Velev: "Re: [PHP-DB] Paging help needed :-("
- Maybe reply: Dobromir Velev: "Re: [PHP-DB] Paging help needed :-("
- Reply: Roger Ramirez: "Re: [PHP-DB] Paging help needed :-("
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

