Page 2 of 2

Re: Increase load time of webpage by shortening code.

Posted: Tue Nov 08, 2011 10:48 am
by shaunak1234

Code: Select all

<?php
$data = mysql_query("SELECT `Name` FROM users ORDER BY srno ASC LIMIT 60" )
or die(mysql_error());
$per_page = 10;
$offset = (intval($_GET['page']) - 1) * $per_page;
$query = "SELECT 'Name' FROM users WHERE srno LIMIT $offset, $per_page";
while($info = mysql_fetch_array( $data))
{
Print"<a target='view' height='10' width='10' href='http://wallpapers.everything.org.in/images/".$info['Name']."'> <img src='images/".$info['Name'] . "' height='90' width='90'></a>";
}
ob_end_flush();
?>
Okay I put the above code in my php code it doesnt show up any thing!

Re: Increase load time of webpage by shortening code.

Posted: Tue Nov 08, 2011 10:59 am
by Celauran
I think you took my suggestion a little too literally. You're clearly not making any use of $per_page, $offset, or $query. $query is broken anyways; you need backticks around the column name, not single quotes.

I couldn't say why your initial query isn't working. What does mysql_num_rows($data) tell you? var_dump($data)?