marcs910 Posted April 9, 2007 Share Posted April 9, 2007 I'm looking to concat the first_name and last_name in the Name column in my table. Every way I've tried I have came up short. Any ideas? echo '<table align="center" cellspacing="0" cellpadding="5"> <tr> <td align="left"><b>Edit</b></td> <td align="left"><b>Delete</b></td> <td align="left"><b>Name</b></td> <td align="left"><b>Email</b></td> <td align="left"><b>Registration Date</b></td> </tr> '; //Get and print all the records $bg = '#eeeeee'; //Set the background color while ($row=mysql_fetch_array ($result, MYSQL_ASSOC)) { $bg = ($bg=='#eeeeee' ? '#ffffff' : '#eeeeee'); // Switch the background color. echo '<tr bgcolor="' . $bg . '"> <td align="left"><a href="edit_user.php?id=' . $row['user_id'] . '">Edit</a></td> <td align="left"><a href="delete_user.php?id=' . $row['user_id'] . '">Delete</a></td> <td align="left">' . $row['first_name'] . '</td> <td align="left">' . $row['email'] . '</td> <td align="left">' . $row['registration_date'] . '</td> </tr>'; } echo '</table>'; } Link to comment https://forums.phpfreaks.com/topic/46328-solved-concat/ Share on other sites More sharing options...
kenrbnsn Posted April 9, 2007 Share Posted April 9, 2007 What did you try? Change <?php <td align="left">' . $row['first_name'] . '</td> ?> to <?php <td align="left">' . $row['first_name'] . ' ' . $row['last_name'] . '</td> ?> The above assumes that the last name is in the field "last_name". Ken Link to comment https://forums.phpfreaks.com/topic/46328-solved-concat/#findComment-225383 Share on other sites More sharing options...
wildteen88 Posted April 9, 2007 Share Posted April 9, 2007 This should do it: <td align="left">' . $row['first_name'] . ' ' . $row['last_name'] . '</td> Umm, ken beat me. Link to comment https://forums.phpfreaks.com/topic/46328-solved-concat/#findComment-225385 Share on other sites More sharing options...
marcs910 Posted April 9, 2007 Author Share Posted April 9, 2007 Worked perfect. You guys rule. Link to comment https://forums.phpfreaks.com/topic/46328-solved-concat/#findComment-225387 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.