strago Posted May 10, 2013 Share Posted May 10, 2013 Original code. $row = mysql_fetch_assoc ($result); echo "<TABLE border=1>\n"; echo "<TR>\n"; foreach ($row as $heading=>$column) { echo "<TD><b><a href={$_SERVER['PHP_SELF']}?order=$heading>$heading</a></b></TD>"; } echo "</TR>\n"; How do I make the code below show the column names with a space between the words? $row = mysql_fetch_assoc ($result); echo "<TABLE border=1>\n"; echo "<TR>\n"; foreach ($row as $heading=>$column) if($column == 'ColumnOne') { echo "<TD><b><a href={$_SERVER['PHP_SELF']}?order=$heading>Column One</a></b></TD>"; } if($column == 'AnotherColumn') { echo "<TD><b><a href={$_SERVER['PHP_SELF']}?order=$heading>Another Column</a></b></TD>"; } else { echo "<TD><b><a href={$_SERVER['PHP_SELF']}?order=$heading>$heading</a></b></TD>"; } echo "</TR>\n"; Quote Link to comment 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.