abch624 Posted June 15, 2009 Share Posted June 15, 2009 Hi Guys, I have a bit of code and I want to add an if statement so that a border is printed on the first row only. $query2="SELECT * FROM products LIMIT 0,2"; $result2=mysql_query($query2); $nume=mysql_num_rows($result2); while($row = mysql_fetch_array($result2)) { $detail = $row['detail']; echo ' <div style="float:left; width:380px; padding-left:15px; padding-top:10px; [u]border-bottom: dotted1px;[/u]"></div> '; } Help guys. I guess it is easy but just cant think of it Cheers - Zahid Link to comment https://forums.phpfreaks.com/topic/162229-mysql-fetch-array/ Share on other sites More sharing options...
rhodesa Posted June 15, 2009 Share Posted June 15, 2009 $query2="SELECT * FROM products LIMIT 0,2"; $result2=mysql_query($query2); $nume=mysql_num_rows($result2); for($n=1;$row = mysql_fetch_array($result2);$n++) { $detail = $row['detail']; $style = 'float:left; width:380px; padding-left:15px; padding-top:10px;'; if($n === 1) $style .= 'border-bottom: dotted 1px;'; echo '<div style="'.$style.'"></div>'; } Link to comment https://forums.phpfreaks.com/topic/162229-mysql-fetch-array/#findComment-856188 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.