// mysql_html_table // Written by: Michael P. Bourque (michael@mbourque.com) // // This very simple script will display your mysql table in an html table // with an option to do simple pagination like next and previous. If you // like this, then please send me an email to inspire me to do more with it. // // To use: // 1. Add this to any php page. // 2. Edit the variables below // 3. Upload to your server // 4. Point your browser to this file // 5. For pagination, add to the link (above) ?Pagesize=20 // Example: // http://yourserver.domain.com/mysql_html_table.php?Pagesize=20 // Set the variables for the database $Host = "localhost"; $User = ""; $Password = ""; $DBName = ""; // Database name $TableName = ""; // Name of table to display // Do not edit below this line $Link = mysql_pconnect ($Host, $User, $Password); if ( $Pagesize ) { if( !$start ) $start = 1; pagination($start,$Link,$DBName,$TableName,$Pagesize); $PaginationQuery = "LIMIT " . $start . ", " . $Pagesize; } $Query = "SELECT * FROM $TableName " . $PaginationQuery; $Result = mysql_db_query ($DBName, $Query, $Link); // Create a table with headers. print ("
".mysql_field_name($Result, $i)." | \n"; } print ("
$Row[$i] | \n"; } print ("