Jamz Posted March 20, 2008 Share Posted March 20, 2008 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 More sharing options...
p2grace Posted March 20, 2008 Share Posted March 20, 2008 Try removing echo '</tr><tr>'; in the middle of your code. You want to continue with td's instead of create a new table row (tr). Link to comment https://forums.phpfreaks.com/topic/97073-one-phone-per-block/#findComment-496806 Share on other sites More sharing options...
Jamz Posted March 20, 2008 Author Share Posted March 20, 2008 That means the text will not go above the image Link to comment https://forums.phpfreaks.com/topic/97073-one-phone-per-block/#findComment-496808 Share on other sites More sharing options...
p2grace Posted March 20, 2008 Share Posted March 20, 2008 You could use a <br /> to control that perhaps. Link to comment https://forums.phpfreaks.com/topic/97073-one-phone-per-block/#findComment-496809 Share on other sites More sharing options...
Styles2304 Posted March 20, 2008 Share Posted March 20, 2008 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.