View Single Post
  #7  
Old 05-15-2008, 12:55 AM
pipesportugal's Avatar
pipesportugal pipesportugal is offline
Sergeant Major
 
Join Date: Jul 2007
Location: Oporto - Portugal
Posts: 99
Default Re: How to display database records on screen?

Hi,

Be careful because it has ocurred to me with WAMP that the php entrance tag <? did not work and forced me to change all my code to tag <?php.

About showing the table content I would suggest to use a class that would show that content no matter the fields/sizes/etc/etc of that table.
This class would read all tables no matter what.

This is an example of the code:

<?php
include("include/config.php");
$table = $_GET['t'];
$lines = $_GET['l'];
$page = $_GET['p'];
require ("classes/class_pagination.php");
$page= new pagination;
$page->conect_to("$hostname", "$user_db", "$pass_db","$database");
$page->setLines($lines);
$page->setTable("$table");
$page->showLines();
$page->showPagelinks($lines);
?>

File config.php would contain Your database info.
File classe_pagination.php would contain the class program.

With this example You can consult/list all Your tables.

The syntax at the browser would be:
www.yourdomain.com/list_table.php?t=tablename&l=linesperpage&p=pagenu mber

Hope I've helped,
pipesportugal
Reply With Quote