Hi everyone,
I am very new to PHP, so please forgive my stupidity. lol.
I have a search page on my site, that allows users to search for other users by:
Gender - Sexuality - Country - City etc.
How would i make it so that the results show x results on each page, with page numbers?? (at the moment its showing all results on one page)
Also, on the results page, it shows the users picture.
Ive tried to make it so that it displays 4 rows with 4 results on each row.
But it shows ALL the results in one row.
Ive heard of paginate, but as i said i am new to php and dont really know what i am doing 🙁
Can anyone help me out please??
Thank you in advance
This is the code that is in my search results page:
[code=php]<?
if (isset($_GET['usrsearch'])||$_GET['advsrc']=="usrsearch") {
$advsrc = "usrsearch";
$query = "SELECT * FROM crib_users WHERE username='".$_GET['keywords']."'";
?>
<? } ?>
<? if ($userDetails['cribtools']==Y){
if (isset($GET['advancesr'])||$GET['advsrc']=="advancesr") {
$advsrc = "advancesr";
$query = "SELECT FROM crib_users WHERE city='".$GET['city']."'";
}
}
else
{
echo "";
}
?>
<?
if (isset($GET['addi'])||$GET['advsrc']=="addi") {
$advsrc = "addi";
$query = "SELECT FROM crib_users WHERE country='".$GET['country']."'";
if ($REQUEST['online']=="1") $query .= " AND online='1'";
if ($REQUEST['online']=="0") $query .= " AND online='0'";
}
?>
<?
if (isset($GET['online'])||$GET['advsrc']=="online") {
$advsrc = "online";
$query = "SELECT * FROM crib_users WHERE active='".$GET['online']."'";
}
if ($GET['start'] == "") $start = 0;
else $start = $_GET['start'];
$limit = 10;
?>
<?
$totalResults = getSqlNumber($query);
$resultsQuery = mysql_query($query);
if ($totalResults==0) {
echo "<script>document.location.href='search.php?search=empty'</script>";
} else {
$i=0;
while ($searchDetails = mysql_fetch_array($resultsQuery)) { ?>
<? if ($searchDetails['gender']=='4'){
$usrgender = 'Female';
} else {
$usrgender = 'Male';
}
?>
<tr height="25" class="BODY">
<td align="center" width="122"> <a href="/<? echo $searchDetails['username'];?>">
<div align="left"><img src="/<? echo $searchDetails['picpath'];?>" width="90" height="90">
</div></td>
<td width="568"> <? echo "<b><font color=\"black\">Username: </font></b>";?>
<font color="black"><? echo $searchDetails['username'];?></a></font><br>
<? echo "<b><font color=\"black\">Gender: </font></b>";?>
<font color="black"><? echo $usrgender;?></font><br>
<? echo "<b><font color=\"black\">City: </font></b>";?>
<font color="black"><? echo $searchDetails['city'];?></font><br>
<? echo "<b><font color=\"black\">Online: </font></b>";?>
<? if ($searchDetails['active']=='1') {
echo "<font color=\"red\">Yes</font>";
} else {
echo "<font color=\"black\">No</font>";
}
?>[/code]