<?php
/**
* @author PHP&MYSQL PrOgRAmMeR EsLAm AhMeD KaNDeL
* @copyright 2008
* @email science20012003@hotmail.com
* @creat time: 3:53 Date 25-6-2008
*/
require_once 'spilt_sql_result.class.php';
/* Connecting, selecting database */
$db_link = mysql_connect("localhost", "root", "123456");
if (!$db_link) {
die("Could not connect: " . mysql_error());
}
mysql_select_db("test_db") or die("Could not select database");
/* Performing SQL query */
$split = new page_spilt("SELECT * FROM `test_table`", $_GET["p"]);
$rs = $split->get_results();
if (is_array($rs)) {
foreach ($rs as $key => $value) {
echo $rs[$key][0] . " " . $rs[$key][1] . " " . $rs[$key][2] . "<br>";
}
//$split->querystring="r=2&d=3"; Just example
$rs = $split->get_numbers(); // يمكن وضع الارقام فى قائمة منسدلة
foreach ($rs as $key => $value) {
if (empty($value))
echo $key . " ";
else
echo "<a href=\"$value\">$key</a> ";
}
echo "<br />results from ".$split->rsfrom." to ".$split->rsto." Total:".$split->totalresnumber;
} else {
echo "No result";
}
/* Closing connection */
mysql_close($db_link);
?>
|