Dysan Posted November 9, 2007 Share Posted November 9, 2007 Why doesn't this work? - I'm trying to display just the letter M if record contains Male, and F id the record contains Female. $record = 1; while($row = mysql_fetch_array($result)) { $sex = substr($row['Sex'], 0, 1; echo "<tr>"; echo "<td>" . $record++ . ") " . $row['Firstname'] . "<br>" . $row['Lastname'] . "</td>"; echo "<td>" . $sex . "</td>"; echo "</tr>"; } echo "</table>"; Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted November 9, 2007 Share Posted November 9, 2007 You didn't close the substr() function. $sex = substr($row['Sex'], 0, 1); Quote Link to comment Share on other sites More sharing options...
Barand Posted November 10, 2007 Share Posted November 10, 2007 That should have given you "Parse error: syntax error, unexpected ';' in C:\Inetpub\wwwroot\test\xxxxxx.php on line 4" which tells you immediately there is a problem there - perhaps something missing before the ';' ? If it didn't I recommend you turn your error reporting on. 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.