View Single Post
Old 10-27-2011, 11:48 AM  
nm_
Confirmed User
 
Industry Role:
Join Date: May 2011
Location: San Diego
Posts: 328
Code:
 if (!$_GET['page'] && !ctype_digit($_GET['page'])) {
	
		throw new Exception('page number must be digit');
	
	}
	
	$page = $_GET['page'];
	$limit = 5;
	
	$max = 'limit ' .($page - 1) * $limit .',' .$limit;
	$data_p = "SELECT * FROM testtable $max";
	$result_2 = mysql_query($data_p);
	
	

	while ($list = mysql_fetch_assoc($result_2)) {
	   // echo data
	   echo $list['random'] . "<br />";
	}
i don't have pdo setup correctly on my test server, but this code worked for me. just replace the table name / row name in this code.
nm_ is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote