dslreports logo
 
    All Forums Hot Topics Gallery
spc
Search similar:


uniqs
1308
billybobthor
join:2004-03-29
Mchenry, IL

billybobthor

Member

Need some html help please

Ok I suck at HTML and I suck even more when it comes to tables. I have a already coded html page that I need to make a few changes to. Basically I need the search box and the browse category box sized down and placed side by side. I have attached a image. IF you can help me out realy quick would be great


twizlar
I dont think so.
Premium Member
join:2003-12-24
Brantford, ON

twizlar

Premium Member

Post a link to the page, or the code.
billybobthor
join:2004-03-29
Mchenry, IL

billybobthor

Member

PM Sent
billybobthor

billybobthor

Member

Here is the code, still looking for help on this please. I just need the two tables moved. I took care of the featured one.

<?php 
function main()
{
 
//global $sbico_search;
$config=mysql_fetch_array(mysql_query("select * from sb_host_config"));
 
$sb_cat_listing=$config["sb_cat_listing"];
 
$policies=mysql_fetch_array(mysql_query("select * from sb_host_policies"));
$cid=0;
 
$sb_suspended_ids='-2';//'coz -1 is used 2 denote admin plans
$sbq_sus="select * from sb_host_members where sb_suspended!='no'";
$sbrs_sus=mysql_query($sbq_sus);
while($sbrow_sus=mysql_fetch_array($sbrs_sus))
$sb_suspended_ids.=", ".$sbrow_sus["sb_id"];
 
                  
 
?>
<table width="100%" border="0" cellspacing="10" cellpadding="2" class="maintablestyle">
<tr>
    <td valign="top"><table width="95%" border="0" align="center" cellpadding="2" cellspacing="0" class="onepxtable">
        <tr> 
            <td align="justify" class="innertablestyle"><?php
echo $policies["sb_welcome_msg"];
            ?></td>
        </tr>
      </table></td>
  </tr>
  <tr> 
    <td valign="top"><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" class="onepxtable">
        <tr> 
          <form name="form1" method="post" action="search_result.php">
            <td width="100%" align="center" valign="middle" class="innertablestyle"><br>
              <input name="keyword" type="text" size="25">
              <select name="cid" id="cid" >
                <option value="0">Choose a category</option>
                <?php
 
$sbcat_arr=array();
$sbord_arr=array();
$rs_query=mysql_query("select * from sb_host_categories order by sb_pid");
 
while($rst=mysql_fetch_array($rs_query))
{
$cat_path="";
$child=mysql_fetch_array(mysql_query("select * from sb_host_categories where sb_pid=".$rst["sb_id"]));
if($child)
continue;
$cat_path.=$rst["sb_cat_name"];
$par=mysql_query("select * from sb_host_categories where sb_id=".$rst["sb_pid"]);
while($parent=mysql_fetch_array($par))
{
$cat_path=$parent["sb_cat_name"]."-".$cat_path;
$par=mysql_query("select * from sb_host_categories where sb_id=".$parent["sb_pid"]);
}
$sbcat_arr[$rst["sb_id"]]=$cat_path;
$sbord_arr[$rst["sb_id"]]=$rst["sb_order_index"];
?>
<!--option value="<?php echo $rst["sb_id"];?>" ><?php echo $cat_path;?></option-->
<?php
}
if($sb_cat_listing=='alpha')
{
asort($sbcat_arr);
foreach($sbcat_arr as $sbkey => $sbval)
{
echo '<option value="'.$sbkey.'"';
//echo($sbkey==$cats)?'selected':'';
echo ' >'.$sbval.'</option>';
}
}
else
{
asort($sbord_arr);
foreach($sbord_arr as $sbkey => $sbval)
{
echo '<option value="'.$sbkey.'"';
//echo($sbkey==$cats)?'selected':'';
echo ' >'.$sbcat_arr[$sbkey].'</option>';
}
}
  ?>
              </select>
              <font class='normal'>&nbsp;              </font>
              <input type="submit"  name="Submit" value="Search">
              <a href="advance_search.php" class="small_link">Advance Search</a> 
              <br>
              <br>
            </td>
          </form>
        </tr>
      </table></td>
  
  <tr> 
    <td valign="top"> <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" >
        <tr> 
          <td><font class="normal"><b>Browse Category</b></font></td>
        </tr>
        <tr > 
          <td class="onepxtable"><table width="100%" border="0" cellspacing="1" cellpadding="2" class="innertablestyle">
              </tr>
  <?php
 
 
 
  $cats_sql="select * from sb_host_categories where sb_pid=$cid ";
if($config["sb_cat_listing"]=="alpha")
{
$cats_sql.=" order by sb_cat_name";
}
else
{
$cats_sql.="  order by sb_order_index";
}
 
$cats_query=mysql_query($cats_sql);
$cnt=1;
                  
 
  
 
while($cats=mysql_fetch_array($cats_query))
{
   
 
$rst_query=mysql_query("Select * from sb_host_categories where sb_pid=".$cats["sb_id"] );
$clist=$cats["sb_id"];
while ( $rst=mysql_fetch_array($rst_query) )
{
 $clist.="," . $rst["sb_id"];
$thislist="-1," . $rst["sb_id"];
while ( $rst=mysql_fetch_array($rst_query) )
{ 
$clist.="," . $rst["sb_id"];
$thislist.="," . $rst["sb_id"];
//echo $rst["sbcat_id"];
}
   $rst_query=mysql_query("Select * from sb_host_categories where sb_pid in (" . $thislist . ")" );
}
 
$sbcat_str= " and  sb_cat IN (" .$clist . ")" ;
 
$sbq_job_cat="select * from sb_host_plans where sb_approved='yes' and sb_host_id not in ($sb_suspended_ids) $sbcat_str and (auction_period= -1 or  UNIX_TIMESTAMP(DATE_ADD(sb_posted_on,INTERVAL auction_period DAY))>UNIX_TIMESTAMP(now())) ";
$sbtotal=mysql_num_rows(mysql_query($sbq_job_cat));
 
if($cnt%3==1)
{
  ?>
              <tr> 
                <td width="20">&nbsp;</td>
                <?php
  }
  ?>
                <td align="left"><font class='normal'> <a href="<?php echo cat_url($cats["sb_id"]);?>"> 
                  <?php echo $cats["sb_cat_name"]; ?></a>(<?php echo $sbtotal; ?>)</font><?php
 
?></td>
                <?php
  if($cnt%3==0)
  {
  ?>
              </tr>
              <?php
  }
  $cnt++;
}
?>
            </table></td>
        </tr>
      </table></td>
  </tr>
  <tr> 
    <td valign="top"> 
<?php  
 
                  
 
      $max_allowed=$config["sb_featured_cnt"];
$sbq_plans="select * from sb_host_plans where sb_approved='yes' and sb_host_id not in ($sb_suspended_ids) and sb_ft_feature='yes' and (auction_period= -1 or UNIX_TIMESTAMP(DATE_ADD(sb_posted_on,INTERVAL auction_period DAY))>UNIX_TIMESTAMP(now()))";
//echo $sbq_plans;
$ff_plans_q=mysql_query($sbq_plans);
 
 
  $num_rows=mysql_num_rows($ff_plans_q);
 
 
if(($config["sb_featured_cnt"]!=0) && ($num_rows!=0)) {?>
      <table width="85%" border="0" align="center" cellpadding="0" cellspacing="1" class="onepxtable">
        <tr class="titlestyle"> 
          <td width="31%">&nbsp;Featured Plans</td>
          <td width="17%">&nbsp;Monthly Fee</td>
          <td width="14%">&nbsp;Setup Fee</td>
          <td width="14%">&nbsp;Disk Space</td>
          <td width="24%">&nbsp;Bandwidth</td>
          <!--td>&nbsp;</td-->
        </tr>
        <?php //
      // $ff_plans_q=mysql_query("select * from sb_host_plans where sb_approved='yes' and 
//sb_ft_feature='yes'");
 
 // $num_rows=mysql_num_rows($ff_plans_q);
 
unset($number);
$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++)
{
 
if($number[$k]==$j)
break;
}
if($k>(count($number)-1))
{
$unique=1;
}
}
$number[$i]=$j;
 
}
}
 
 
 
$row=0;
$cnt=0;
$ff_plans=mysql_fetch_array($ff_plans_q);
while (($ff_plans)&&($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 comp from sb_host_members where sb_id=".$ff_plans["sb_host_id"]));
//where sb_id=".$ff_plans["sb_company_id"]));
 
$rec_class="innertablestyle";
if($cnt%2==0)
{ $rec_class="alternatecolor"; }
if($ff_plans["sb_highlight"]=="yes")
{ 
$rec_class="highlighted";
if($cnt%2==0)
{ $rec_class="highlighted1"; }
}
 
?>
        <tr class="<?php echo $rec_class;?>" height="25"> 
          <td>&nbsp;<font class="normal"><a href="<?php echo item_url($ff_plans["sb_id"]);?>"><?php
   if($ff_plans["sb_bold"]=="yes")
   { echo "<b>";}
   if(strlen($ff_plans["sb_title"])>40)
   echo substr($ff_plans["sb_title"],0,40)."...";
   else
   echo $ff_plans["sb_title"];
   if($ff_plans["sb_bold"]=="yes")
   { echo "</b>";}
   //die();
   ?></a></font></td>
          <td>&nbsp;<font class="normal"><?php 
//if($comp["sb_show_profile"]=="yes")
//{ echo "<a href='view_profile.php?id=".$comp["sb_id"]."'>";} 
   if($ff_plans["sb_bold"]=="yes")
   { echo "<b>";}
   if ($ff_plans["sb_mprice"]== -1)
   echo "Unlimited";
   else
   echo $config["sb_fee_symbol"]." ".$ff_plans["sb_mprice"];
 
   if($ff_plans["sb_bold"]=="yes")
   { echo "</b>";}
//if($comp["sb_show_profile"]=="yes")
//{ echo "</a>";} 
  ?></font></td>
          <td><font class="normal">&nbsp;<?php 
//if($comp["sb_show_profile"]=="yes")
//{ echo "<a href='view_profile.php?id=".$comp["sb_id"]."'>";} 
   if($ff_plans["sb_bold"]=="yes")
   { echo "<b>";}
   if ($ff_plans["sb_setup_fee"]== -1)
   echo "Free Setup";
   else
   echo $config["sb_fee_symbol"]." ".$ff_plans["sb_setup_fee"];
 
   if($ff_plans["sb_bold"]=="yes")
   { echo "</b>";}
//if($comp["sb_show_profile"]=="yes")
//{ echo "</a>";} 
  ?>
            &nbsp;</font></td>
          <td><font class="normal">&nbsp;<?php 
//if($comp["sb_show_profile"]=="yes")
//{ echo "<a href='view_profile.php?id=".$comp["sb_id"]."'>";} 
   if($ff_plans["sb_bold"]=="yes")
   { echo "<b>";}
   if ($ff_plans["sb_disk_space"]== -1)
   echo "Unlimited";
   else
   echo $ff_plans["sb_disk_space"]." MB";
 
   if($ff_plans["sb_bold"]=="yes")
   { echo "</b>";}
//if($comp["sb_show_profile"]=="yes")
//{ echo "</a>";} 
  ?>
            </font></td>
          <td>&nbsp;<font class="normal"><?php 
//$query=mysql_num_rows(mysql_query("select * from sb_host_plandatabase where sb_plan_id=".$ff_plans["sb_id"]));
   if($ff_plans["sb_bold"]=="yes")
   { echo "<b>";}
    if($ff_plans["sb_bandwidth"]== -1)
echo 'Unlimited';
else
echo $ff_plans["sb_bandwidth"]." GB";
//echo $ff_plans["sb_bandwidth"];
   if($ff_plans["sb_bold"]=="yes")
   { echo "</b>";}
?></font></td>
          <!--td>&nbsp;</td-->
        </tr><?php
$cnt++;
}//if display
$ff_plans=mysql_fetch_array($ff_plans_q);
$row++;
}// end while
      ?></table><?php  }?></td>
  </tr>
  <tr> 
    <td valign="top"><?php 
 
 
                  
 
$plans_q=mysql_query("select * from sb_host_plans where sb_approved='yes' and sb_host_id not in ($sb_suspended_ids) and (auction_period= -1 or  UNIX_TIMESTAMP(DATE_ADD(sb_posted_on,INTERVAL auction_period DAY))>UNIX_TIMESTAMP(now())) order by sb_id desc");
$num_rows=mysql_num_rows($plans_q);
 
 
 
 
if(($config["sb_featured_cnt"]!=0) && ($num_rows!=0)) { ?>
      <table width="55%" border="0" align="center" cellpadding="0" cellspacing="1" class="onepxtable">
        <tr class="titlestyle"> 
          <td width="31%">&nbsp;Latest Plans</td>
          <td width="17%">&nbsp;Monthly Fee</td>
          <td width="14%">&nbsp;Setup Fee</td>
          <td width="14%">&nbsp;Disk Space</td>
          <td width="24%">&nbsp;Bandwidth</td>
          <!--td>&nbsp;</td-->
        </tr>
        <?php
        //$plans_q=mysql_query("select * from sb_host_plans where sb_approved='yes' order by sb_id desc");
//$num_rows=mysql_num_rows($plans_q);
$cnt=0;
while (($plans=mysql_fetch_array($plans_q))&&($cnt<$max_allowed))
{ 
 
$rec_class="innertablestyle";
if($cnt%2==0)
{ $rec_class="alternatecolor"; }
if($plans["sb_highlight"]=="yes")
{ 
$rec_class="highlighted";
if($cnt%2==0)
{ $rec_class="highlighted1"; }
}
 
?>
        <tr class="<?php echo $rec_class;?>" height="25"> 
          <td><font class="normal">&nbsp;<a href="<?php echo item_url($plans["sb_id"]);?>"><?php
   if($plans["sb_bold"]=="yes")
   { 
   echo "<b>";}
   if(strlen($plans["sb_title"])>40)
   echo substr($plans["sb_title"],0,40)."...";
   else
   echo $plans["sb_title"];
   if($plans["sb_bold"]=="yes")
   { echo "</b>";}
   ?></a></font></td>
          <td>&nbsp;<font class="normal"><?php 
//if($comp["sb_show_profile"]=="yes")
//{ echo "<a href='view_profile.php?id=".$comp["sb_id"]."'>";} 
   if($plans["sb_bold"]=="yes")
   { echo "<b>";}
   if ($plans["sb_mprice"]== -1)
   echo "Unlimited";
   else
   echo $config["sb_fee_symbol"]." ".$plans["sb_mprice"];
 
   if($plans["sb_bold"]=="yes")
   { echo "</b>";}
//if($comp["sb_show_profile"]=="yes")
//{ echo "</a>";} 
  ?></font></td>
          <td><font class="normal">&nbsp;<?php 
//if($comp["sb_show_profile"]=="yes")
//{ echo "<a href='view_profile.php?id=".$comp["sb_id"]."'>";} 
   if($plans["sb_bold"]=="yes")
   { echo "<b>";}
   if ($plans["sb_setup_fee"]== -1)
   echo "Free Setup";
   else
   echo $config["sb_fee_symbol"]." ".$plans["sb_setup_fee"];
 
   if($plans["sb_bold"]=="yes")
   { echo "</b>";}
//if($comp["sb_show_profile"]=="yes")
//{ echo "</a>";} 
  ?></font></td>
          <td><font class="normal">&nbsp;<?php 
//if($comp["sb_show_profile"]=="yes")
//{ echo "<a href='view_profile.php?id=".$comp["sb_id"]."'>";} 
   if($plans["sb_bold"]=="yes")
   { echo "<b>";}
   if ($plans["sb_disk_space"]== -1)
   echo "Unlimited";
   else
   echo $plans["sb_disk_space"]." MB";
 
   if($plans["sb_bold"]=="yes")
   { echo "</b>";}
//if($comp["sb_show_profile"]=="yes")
//{ echo "</a>";} 
  ?></font></td>
          <td><font class="normal">&nbsp;<?php 
// $query_l=mysql_num_rows(mysql_query("select * from sb_host_planlang where sb_plan_id=".$plans["sb_id"]));
 
   if($plans["sb_bold"]=="yes")
   { echo "<b>";}
    if($plans["sb_bandwidth"]== -1)
echo 'Unlimited';
else
echo $plans["sb_bandwidth"]." GB";
//echo $plans["sb_bandwidth"];
 
   if($plans["sb_bold"]=="yes")
   { echo "</b>";}
?></font></td>
          <!--td>&nbsp;</td-->
        </tr>
        <?php
$cnt++;
}// end while
      ?>
      </table><?php }?></td>
  </tr>
</table><?php
}
include_once'template.php';
?>
 

nil

join:2000-11-27

nil

Bringing this thread back from the dead because someone would like to help.

To reply: press reply on my post.

Ashke
Flips page and continues reading
Premium Member
join:2007-09-11
Minneapolis, MN

Ashke

Premium Member

Just posting a cleaner entry of the OP's php...

<?php 
function main()
{
  
//global $sbico_search;
$config=mysql_fetch_array(mysql_query("select * from sb_host_config"));
  
$sb_cat_listing=$config["sb_cat_listing"];
  
$policies=mysql_fetch_array(mysql_query("select * from sb_host_policies"));
$cid=0;
  
$sb_suspended_ids='-2';//'coz -1 is used 2 denote admin plans
$sbq_sus="select * from sb_host_members where sb_suspended!='no'";
$sbrs_sus=mysql_query($sbq_sus);
while($sbrow_sus=mysql_fetch_array($sbrs_sus))
$sb_suspended_ids.=", ".$sbrow_sus["sb_id"];
  
                   
  
?>
<table width="100%" border="0" cellspacing="10" cellpadding="2" class="maintablestyle">
<tr>
    <td valign="top"><table width="95%" border="0" align="center" cellpadding="2" cellspacing="0" class="onepxtable">
        <tr> 
            <td align="justify" class="innertablestyle"><?php
echo $policies["sb_welcome_msg"];
            ?></td>
        </tr>
      </table></td>
  </tr>
  <tr> 
    <td valign="top"><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" class="onepxtable">
        <tr> 
          <form name="form1" method="post" action="search_result.php">
            <td width="100%" align="center" valign="middle" class="innertablestyle">
 
              <input name="keyword" type="text" size="25">
              <select name="cid" id="cid" >
                <option value="0">Choose a category</option>
                <?php
  
$sbcat_arr=array();
$sbord_arr=array();
$rs_query=mysql_query("select * from sb_host_categories order by sb_pid");
  
while($rst=mysql_fetch_array($rs_query))
{
$cat_path="";
$child=mysql_fetch_array(mysql_query("select * from sb_host_categories where sb_pid=".$rst["sb_id"]));
if($child)
continue;
$cat_path.=$rst["sb_cat_name"];
$par=mysql_query("select * from sb_host_categories where sb_id=".$rst["sb_pid"]);
while($parent=mysql_fetch_array($par))
{
$cat_path=$parent["sb_cat_name"]."-".$cat_path;
$par=mysql_query("select * from sb_host_categories where sb_id=".$parent["sb_pid"]);
}
$sbcat_arr[$rst["sb_id"]]=$cat_path;
$sbord_arr[$rst["sb_id"]]=$rst["sb_order_index"];
?>
<!--option value="<?php echo $rst["sb_id"];?>" ><?php echo $cat_path;?></option-->
<?php
}
if($sb_cat_listing=='alpha')
{
asort($sbcat_arr);
foreach($sbcat_arr as $sbkey => $sbval)
{
echo '<option value="'.$sbkey.'"';
//echo($sbkey==$cats)?'selected':'';
echo ' >'.$sbval.'</option>';
}
}
else
{
asort($sbord_arr);
foreach($sbord_arr as $sbkey => $sbval)
{
echo '<option value="'.$sbkey.'"';
//echo($sbkey==$cats)?'selected':'';
echo ' >'.$sbcat_arr[$sbkey].'</option>';
}
}
  ?>
              </select>
              <font class='normal'>&nbsp;              </font>
              <input type="submit"  name="Submit" value="Search">
              <a href="advance_search.php" class="small_link">Advance Search</a> 
              
 
              
 
            </td>
          </form>
        </tr>
      </table></td>
   
  <tr> 
    <td valign="top"> <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" >
        <tr> 
          <td><font class="normal"><b>Browse Category</b></font></td>
        </tr>
        <tr > 
          <td class="onepxtable"><table width="100%" border="0" cellspacing="1" cellpadding="2" class="innertablestyle">
              </tr>
  <?php
  
  
  
  $cats_sql="select * from sb_host_categories where sb_pid=$cid ";
if($config["sb_cat_listing"]=="alpha")
{
$cats_sql.=" order by sb_cat_name";
}
else
{
$cats_sql.="  order by sb_order_index";
}
  
$cats_query=mysql_query($cats_sql);
$cnt=1;
                   
  
   
  
while($cats=mysql_fetch_array($cats_query))
{
    
  
$rst_query=mysql_query("Select * from sb_host_categories where sb_pid=".$cats["sb_id"] );
$clist=$cats["sb_id"];
while ( $rst=mysql_fetch_array($rst_query) )
{
 $clist.="," . $rst["sb_id"];
$thislist="-1," . $rst["sb_id"];
while ( $rst=mysql_fetch_array($rst_query) )
{ 
$clist.="," . $rst["sb_id"];
$thislist.="," . $rst["sb_id"];
//echo $rst["sbcat_id"];
}
   $rst_query=mysql_query("Select * from sb_host_categories where sb_pid in (" . $thislist . ")" );
}
  
$sbcat_str= " and  sb_cat IN (" .$clist . ")" ;
  
$sbq_job_cat="select * from sb_host_plans where sb_approved='yes' and sb_host_id not in ($sb_suspended_ids) $sbcat_str and (auction_period= -1 or  UNIX_TIMESTAMP(DATE_ADD(sb_posted_on,INTERVAL auction_period DAY))>UNIX_TIMESTAMP(now())) ";
$sbtotal=mysql_num_rows(mysql_query($sbq_job_cat));
  
if($cnt%3==1)
{
  ?>
              <tr> 
                <td width="20">&nbsp;</td>
                <?php
  }
  ?>
                <td align="left"><font class='normal'> <a href="<?php echo cat_url($cats["sb_id"]);?>"> 
                  <?php echo $cats["sb_cat_name"]; ?></a>(<?php echo $sbtotal; ?>)</font><?php
  
?></td>
                <?php
  if($cnt%3==0)
  {
  ?>
              </tr>
              <?php
  }
  $cnt++;
}
?>
            </table></td>
        </tr>
      </table></td>
  </tr>
  <tr> 
    <td valign="top"> 
<?php  
  
                   
  
      $max_allowed=$config["sb_featured_cnt"];
$sbq_plans="select * from sb_host_plans where sb_approved='yes' and sb_host_id not in ($sb_suspended_ids) and sb_ft_feature='yes' and (auction_period= -1 or UNIX_TIMESTAMP(DATE_ADD(sb_posted_on,INTERVAL auction_period DAY))>UNIX_TIMESTAMP(now()))";
//echo $sbq_plans;
$ff_plans_q=mysql_query($sbq_plans);
  
  
  $num_rows=mysql_num_rows($ff_plans_q);
  
  
if(($config["sb_featured_cnt"]!=0) && ($num_rows!=0)) {?>
      <table width="85%" border="0" align="center" cellpadding="0" cellspacing="1" class="onepxtable">
        <tr class="titlestyle"> 
          <td width="31%">&nbsp;Featured Plans</td>
          <td width="17%">&nbsp;Monthly Fee</td>
          <td width="14%">&nbsp;Setup Fee</td>
          <td width="14%">&nbsp;Disk Space</td>
          <td width="24%">&nbsp;Bandwidth</td>
          <!--td>&nbsp;</td-->
        </tr>
        <?php //
      // $ff_plans_q=mysql_query("select * from sb_host_plans where sb_approved='yes' and 
//sb_ft_feature='yes'");
  
 // $num_rows=mysql_num_rows($ff_plans_q);
  
unset($number);
$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++)
{
  
if($number[$k]==$j)
break;
}
if($k>(count($number)-1))
{
$unique=1;
}
}
$number[$i]=$j;
  
}
}
  
  
  
$row=0;
$cnt=0;
$ff_plans=mysql_fetch_array($ff_plans_q);
while (($ff_plans)&&($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 comp from sb_host_members where sb_id=".$ff_plans["sb_host_id"]));
//where sb_id=".$ff_plans["sb_company_id"]));
  
$rec_class="innertablestyle";
if($cnt%2==0)
{ $rec_class="alternatecolor"; }
if($ff_plans["sb_highlight"]=="yes")
{ 
$rec_class="highlighted";
if($cnt%2==0)
{ $rec_class="highlighted1"; }
}
  
?>
        <tr class="<?php echo $rec_class;?>" height="25"> 
          <td>&nbsp;<font class="normal"><a href="<?php echo item_url($ff_plans["sb_id"]);?>"><?php
   if($ff_plans["sb_bold"]=="yes")
   { echo "<b>";}
   if(strlen($ff_plans["sb_title"])>40)
   echo substr($ff_plans["sb_title"],0,40)."...";
   else
   echo $ff_plans["sb_title"];
   if($ff_plans["sb_bold"]=="yes")
   { echo "</b>";}
   //die();
   ?></a></font></td>
          <td>&nbsp;<font class="normal"><?php 
//if($comp["sb_show_profile"]=="yes")
//{ echo "<a href='view_profile.php?id=".$comp["sb_id"]."'>";} 
   if($ff_plans["sb_bold"]=="yes")
   { echo "<b>";}
   if ($ff_plans["sb_mprice"]== -1)
   echo "Unlimited";
   else
   echo $config["sb_fee_symbol"]." ".$ff_plans["sb_mprice"];
  
   if($ff_plans["sb_bold"]=="yes")
   { echo "</b>";}
//if($comp["sb_show_profile"]=="yes")
//{ echo "</a>";} 
  ?></font></td>
          <td><font class="normal">&nbsp;<?php 
//if($comp["sb_show_profile"]=="yes")
//{ echo "<a href='view_profile.php?id=".$comp["sb_id"]."'>";} 
   if($ff_plans["sb_bold"]=="yes")
   { echo "<b>";}
   if ($ff_plans["sb_setup_fee"]== -1)
   echo "Free Setup";
   else
   echo $config["sb_fee_symbol"]." ".$ff_plans["sb_setup_fee"];
  
   if($ff_plans["sb_bold"]=="yes")
   { echo "</b>";}
//if($comp["sb_show_profile"]=="yes")
//{ echo "</a>";} 
  ?>
            &nbsp;</font></td>
          <td><font class="normal">&nbsp;<?php 
//if($comp["sb_show_profile"]=="yes")
//{ echo "<a href='view_profile.php?id=".$comp["sb_id"]."'>";} 
   if($ff_plans["sb_bold"]=="yes")
   { echo "<b>";}
   if ($ff_plans["sb_disk_space"]== -1)
   echo "Unlimited";
   else
   echo $ff_plans["sb_disk_space"]." MB";
  
   if($ff_plans["sb_bold"]=="yes")
   { echo "</b>";}
//if($comp["sb_show_profile"]=="yes")
//{ echo "</a>";} 
  ?>
            </font></td>
          <td>&nbsp;<font class="normal"><?php 
//$query=mysql_num_rows(mysql_query("select * from sb_host_plandatabase where sb_plan_id=".$ff_plans["sb_id"]));
   if($ff_plans["sb_bold"]=="yes")
   { echo "<b>";}
    if($ff_plans["sb_bandwidth"]== -1)
echo 'Unlimited';
else
echo $ff_plans["sb_bandwidth"]." GB";
//echo $ff_plans["sb_bandwidth"];
   if($ff_plans["sb_bold"]=="yes")
   { echo "</b>";}
?></font></td>
          <!--td>&nbsp;</td-->
        </tr><?php
$cnt++;
}//if display
$ff_plans=mysql_fetch_array($ff_plans_q);
$row++;
}// end while
      ?></table><?php  }?></td>
  </tr>
  <tr> 
    <td valign="top"><?php 
  
  
                   
  
$plans_q=mysql_query("select * from sb_host_plans where sb_approved='yes' and sb_host_id not in ($sb_suspended_ids) and (auction_period= -1 or  UNIX_TIMESTAMP(DATE_ADD(sb_posted_on,INTERVAL auction_period DAY))>UNIX_TIMESTAMP(now())) order by sb_id desc");
$num_rows=mysql_num_rows($plans_q);
  
  
  
  
if(($config["sb_featured_cnt"]!=0) && ($num_rows!=0)) { ?>
      <table width="55%" border="0" align="center" cellpadding="0" cellspacing="1" class="onepxtable">
        <tr class="titlestyle"> 
          <td width="31%">&nbsp;Latest Plans</td>
          <td width="17%">&nbsp;Monthly Fee</td>
          <td width="14%">&nbsp;Setup Fee</td>
          <td width="14%">&nbsp;Disk Space</td>
          <td width="24%">&nbsp;Bandwidth</td>
          <!--td>&nbsp;</td-->
        </tr>
        <?php
        //$plans_q=mysql_query("select * from sb_host_plans where sb_approved='yes' order by sb_id desc");
//$num_rows=mysql_num_rows($plans_q);
$cnt=0;
while (($plans=mysql_fetch_array($plans_q))&&($cnt<$max_allowed))
{ 
  
$rec_class="innertablestyle";
if($cnt%2==0)
{ $rec_class="alternatecolor"; }
if($plans["sb_highlight"]=="yes")
{ 
$rec_class="highlighted";
if($cnt%2==0)
{ $rec_class="highlighted1"; }
}
  
?>
        <tr class="<?php echo $rec_class;?>" height="25"> 
          <td><font class="normal">&nbsp;<a href="<?php echo item_url($plans["sb_id"]);?>"><?php
   if($plans["sb_bold"]=="yes")
   { 
   echo "<b>";}
   if(strlen($plans["sb_title"])>40)
   echo substr($plans["sb_title"],0,40)."...";
   else
   echo $plans["sb_title"];
   if($plans["sb_bold"]=="yes")
   { echo "</b>";}
   ?></a></font></td>
          <td>&nbsp;<font class="normal"><?php 
//if($comp["sb_show_profile"]=="yes")
//{ echo "<a href='view_profile.php?id=".$comp["sb_id"]."'>";} 
   if($plans["sb_bold"]=="yes")
   { echo "<b>";}
   if ($plans["sb_mprice"]== -1)
   echo "Unlimited";
   else
   echo $config["sb_fee_symbol"]." ".$plans["sb_mprice"];
  
   if($plans["sb_bold"]=="yes")
   { echo "</b>";}
//if($comp["sb_show_profile"]=="yes")
//{ echo "</a>";} 
  ?></font></td>
          <td><font class="normal">&nbsp;<?php 
//if($comp["sb_show_profile"]=="yes")
//{ echo "<a href='view_profile.php?id=".$comp["sb_id"]."'>";} 
   if($plans["sb_bold"]=="yes")
   { echo "<b>";}
   if ($plans["sb_setup_fee"]== -1)
   echo "Free Setup";
   else
   echo $config["sb_fee_symbol"]." ".$plans["sb_setup_fee"];
  
   if($plans["sb_bold"]=="yes")
   { echo "</b>";}
//if($comp["sb_show_profile"]=="yes")
//{ echo "</a>";} 
  ?></font></td>
          <td><font class="normal">&nbsp;<?php 
//if($comp["sb_show_profile"]=="yes")
//{ echo "<a href='view_profile.php?id=".$comp["sb_id"]."'>";} 
   if($plans["sb_bold"]=="yes")
   { echo "<b>";}
   if ($plans["sb_disk_space"]== -1)
   echo "Unlimited";
   else
   echo $plans["sb_disk_space"]." MB";
  
   if($plans["sb_bold"]=="yes")
   { echo "</b>";}
//if($comp["sb_show_profile"]=="yes")
//{ echo "</a>";} 
  ?></font></td>
          <td><font class="normal">&nbsp;<?php 
// $query_l=mysql_num_rows(mysql_query("select * from sb_host_planlang where sb_plan_id=".$plans["sb_id"]));
  
   if($plans["sb_bold"]=="yes")
   { echo "<b>";}
    if($plans["sb_bandwidth"]== -1)
echo 'Unlimited';
else
echo $plans["sb_bandwidth"]." GB";
//echo $plans["sb_bandwidth"];
  
   if($plans["sb_bold"]=="yes")
   { echo "</b>";}
?></font></td>
          <!--td>&nbsp;</td-->
        </tr>
        <?php
$cnt++;
}// end while
      ?>
      </table><?php }?></td>
  </tr>
</table><?php
}
include_once'template.php';
?>