Forum Moderators: coopster
Can anyone possible help me with this, I am really stuck.
The code I have shown below is spitting out image icons displayed in a table. It is currently allowing 2 cells each row then goes to a new 'tr'.
Can anyone see how I can change this to allow 3 or 4 results per table row?
[php]
<table width="100%" border=0 align=center cellpadding=0 cellspacing=0>
<tbody>
<tr valign=center>
<td height="25" colspan="2" align=center><h2 class="text6">Featured Employers</h2></td>
</tr>
<?php
$prm_emp_q=mysql_query("select * from sbjbs_premium_gallery where sb_approved='yes' ");
$num_rows=mysql_num_rows($prm_emp_q);
$max_allowed=$premium_cnt;
$number[0]=-1;
if($num_rows>$max_allowed)
{
for($i=0;$i<$max_allowed;$i++)
{
$unique=0;
while($unique==0)
{
$j=rand(0,$num_rows-1);
for($k=0;$k<count($number);$k++)
{
//echo $j;
if($number[$k]==$j)
break;
}
if($k>(count($number)-1))
{
$unique=1;
}
}
$number[$i]=$j;
}
}// end if num > no_allowed
/*for($k=0;$k<count($number);$k++)
{
echo $number[$k]." ";
}*/
$row=0;
$cnt=0;
$prm_emp=mysql_fetch_array($prm_emp_q);
while (($prm_emp)&&($cnt<$max_allowed))
{
$display=0;
if($num_rows>$max_allowed)
{
for($k=0;$k<count($number);$k++)
{
if($number[$k]==$row)
{
$display=1;
}
}
}
else
{
$display=1;
}
if($display==1)
{
$comp=mysql_fetch_array(mysql_query("select * from sbjbs_companies where
sb_id=".$prm_emp["sb_profile_id"]." and sb_approved='yes' and sb_show_profile='yes' "));
if($cnt%2==0)
{
?><tr valign=center><?php
}
?><td width="50%" align="center"><?php
if($comp["sb_show_profile"]=="yes")
{ echo "<a href='view_profile.php?id=".$comp["sb_id"]."'>";}
?><img src="uploadedimages/<?php echo $prm_emp["sb_img_url"];?>"
<?php echo $imgpmt;?> alt="<? echo $comp["sb_name"];?>" border="0"><?php
if($comp["sb_show_profile"]=="yes")
{ echo "</a>";}
?></td><?php
if($cnt%2==1)
{
?></tr><?php
}
$cnt++;
}//if display
$prm_emp=mysql_fetch_array($prm_emp_q);
$row++;
}// end while
?></tbody>
</table>
[/php]
There is a possibility that this setting isnt in this code.
I bought a script and have just learnt the hard way why you should just write your own instead of attmpting to wade through pages and pages of someone elses CRAPPY coding ;)