Hi All.
I am pulling my images from database and showing it on the page. It is working fine but I want to limit 5 or 3 pictures in 1 row and then start a new row with 3 or 5 pictures. (3 or 5 once someone tell me the code we can set easily). It will continue for almost 6 rows then the link for next page comes where again it will show more pictures.
Here is my code please help me. Please
<?php
include("includes/config.php");
include("includes/affiliates.php");
include("classes/search.class.php");
$search=new search;
$sql="select * from meta_tags";
$result=mysql_query($sql);
$data_set=mysql_fetch_array($result);
?>
<html>
<head>
<title><?=$data_set["main_title"]?></title>
<link href="css/style.css" rel=stylesheet>
<!-- The site discusses these topics: free community site, community, communitys, indian community, muslim, india, sikh, indian bride, matrimonals -->
</head>
<?php
include("includes/top.php");
include("includes/left.php");
?>
<!-- middle_content -->
<td width="58%" bgcolor='#FFFFFF' valign='top'>
<?php
if ($_SESSION[session_user]!='')
{
echo "<table width=98% cellpadding=2 cellspacing=2>";
?>
<?php
$sql="select * from members_contacted where mem_contact_id = $_SESSION[user_id] and accepted = '1'";
$res=mysql_query($sql);
//print $sql;
$num_rows=mysql_num_rows($res);
if($num_rows==0)
{
$aa=1;
}
else
{
$aa=0;
}
?>
<!-- CENTER STARTS HERE -->
<tr>
<td colspan=2>
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td width="350" height="7"><spacer type="block" width="350" height="7"></td>
<td width="220"><spacer type="block" width="220"></td>
</tr>
<tr>
<td align="left" class='myClass'><b>Members who contacted me</b></td>
</tr>
<?php
if($aa==1)
{
?>
</table>
<table cellspacing="0" cellpadding="4" border="0" width="100%">
<tr valign=top>
<td colspan="2" class="mediumblackbold">
You have not been contacted by any one yet.
</td></tr>
</table>
<?php
}
else
{
?>
<!-- CENTER STARTS HERE -->
<table cellspacing="0" cellpadding="2" border="0" width="100%">
<tr valign=top>
<td colspan="2" class="mediumblackbold">
You are browsing profiles of: <font class="mediumblack">members whom you contacted</font>
</td>
</tr>
</table>
</div>
<tr>
<td colspan=2>
<table width='100%' cellpadding=2 cellspacing=2>
<tr>
<?php
$tot_photos=0;
$sql="select photo_url from users where auto_id=$data_set[my_id]";
$res=mysql_query($sql);
$data_set=mysql_fetch_array($res);
if($data_set["photo_url"]!=Null)
{
$tot_photos=$tot_photos+1;
}
$sql="select * from members_contacted where mem_contact_id = $_SESSION[user_id] and accepted='1'";
$res=mysql_query($sql);
$sr_no=1;
while($data_set=mysql_fetch_array($res))
{
//$sql="select * from users a, occupation b where a.occupation = b.value and a.auto_id=$data_set[my_id]";
$sql="select * from users where auto_id=$data_set[my_id]";
$result=mysql_query($sql);
$d_s=mysql_fetch_array($result);
if($sr_no%2==0)
{
print "</tr><tr>";
}
?>
<td width='33%' class='reg_left'>
<div align='center'>
<img src="image_gd/profile_image1.php?<?=$d_s["photo_url"]?>" border="0"></a>
<br>
<?php
if($data_set["accepted"]=='1')
{
print "Accepted";
}
else
{
print "<a href='accept_message.php?mess_id=$data_set[contact_id]'>Accept</a>";
}
?>
<br>
<a href="profile.php?username=<?=$d_s["username"]?>" class="smallbluelink"><?=$d_s["username"]?></a>
<br>
<a href='send_message.php?contact=<?=$d_s["username"]?>'>Send Message</a></b>
</div>
</td>
<?php
}
?>
</table>
</div><br>
<!-- CENTER ENDS HERE -->
<?php
}
?>
<!-- CENTER ENDS HERE -->
<?php
}
else{
print ("<script>window.location='validate_login.php';</script>");
}
?>
</td>
<?php
require("includes/right.php");
require("includes/bottom.php");
?>
and here is the output of this code. All I want is break the count of pictures to 3 and then start a new row, and show 3 more pictures then start a new row, this way continue for 5 rows and then a link for next page and on next page samething, 3 pics for 5 rows and then next page.
if 1 profile has 400 friends, each page will show 3 friends pictures with 6 rows so that means 18 friends on 1 page and then next page, 18 friends on second page and next page..like that continue till finishes 400 friends (its just an example).
this is the out put of the code
Thank you so much




Reply With Quote

Bookmarks