Snooble Posted March 2, 2007 Share Posted March 2, 2007 while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "\t<tr>\n"; foreach ($line as $col_value) { echo "\t\t<td>$col_value</td>\n"; } $count++; echo "\t</tr>\n"; } echo "</table>\n"; This code works fine. But i have two fields in the table that i want to display differently. I want everything from the fields Download and Mirror to be displayed within a <a href='INFOFROMDB'>Download here</a> manner. Any help. Getting real stuck on this. As my code loops a chunk of data. i need to break it up but keep it in a loop. Thank you, Snooble Quote Link to comment https://forums.phpfreaks.com/topic/40839-a-little-echo-trouble-database/ Share on other sites More sharing options...
Orio Posted March 2, 2007 Share Posted March 2, 2007 Add a little if... <?php while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "\t<tr>\n"; foreach ($line as $col => $col_value) { if($col != "Mirror" && $col != "Download") echo "\t\t<td>$col_value</td>\n"; else echo "\t\t<td><a href=\"".$col_value."\">".$col." Here</a></td>\n"; } $count++; echo "\t</tr>\n"; } echo "</table>\n"; ?> Orio. Quote Link to comment https://forums.phpfreaks.com/topic/40839-a-little-echo-trouble-database/#findComment-197727 Share on other sites More sharing options...
Snooble Posted March 2, 2007 Author Share Posted March 2, 2007 I absolutely love you. Thank you so much! I'll have to read this code again and again because it's all this bloody $col => $col_value stuff. key and value if i'm right but i have no idea, i'll have a manual read. THANK YOU!!!!! Genius Snooble Quote Link to comment https://forums.phpfreaks.com/topic/40839-a-little-echo-trouble-database/#findComment-197733 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.