Jump to content

One Phone Per Block


Jamz

Recommended Posts

Hi There Yet Again,

 

This is is great by the way! Great help on here!

 

Right down to the code!

 

So far i have this peice of code:

 

<?php 
$brand = $_GET['brand'];
$count = 0;
$stop;
include('images/config.php');
$database = mysql_connect($hostname,$username,$password) or die("Could not connect to server");
mysql_select_db($table,$database) or die("Could not find table");
$query = "SELECT DISTINCT `Model.Name`,`Model.ImageSmall` FROM Phone_Feed WHERE `Model.Make`='$brand'";
$result = mysql_query ($query) or die(mysql_error());;
while ($row = mysql_fetch_assoc($result)) {
$name = $row['Model.Name'];
$img = $row['Model.ImageSmall'];  

while ($count < 6){
echo '<td width="100" align="center" bgcolor="#CCCCCC" class="deals"><strong>'.$name.'</strong></td>';
$stop = $name;
$count++;
}
$count=0;
$stop=0;
echo '</tr><tr>';
while ($count < 6){
echo '<td align="center" valign="middle" class="deals"><img src="'.$img.'" alt="" /></td>';
$count++;
}
echo '</tr><tr><td colspan="8" align="center" valign="middle"></td></tr>';
$count=0;
}
?> 

 

But im having a problem with it just showing one phone per block... its showing the same phone across the line:

http://www.jamessimpson.org/PhoneWeb/showbrand.php?brand=Nokia

 

I just want it to have a different phone next to each other, instead of repeting eachother across the row.

 

cheers

 

James

Link to comment
https://forums.phpfreaks.com/topic/97073-one-phone-per-block/
Share on other sites

It's in the while statement . . .

 

Change this:

while ($count < 6){
echo '<td align="center" valign="middle" class="deals"><img src="'.$img.'" alt="" /></td>';
$count++;

 

to this:

 

{
echo '<td align="center" valign="middle" class="deals"><img src="'.$img.'" alt="" /></td>';

Link to comment
https://forums.phpfreaks.com/topic/97073-one-phone-per-block/#findComment-496812
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.