Link to home
Start Free TrialLog in
Avatar of wantabe2
wantabe2Flag for United States of America

asked on

PHP Code Question (Displaying of Data)

Hello,
The following code displays some data from a MySQL database in a form on a web browser.

<td><?php echo "".$row['fname']; ?></td> 
<td><?php echo "".$row['lname']; ?></td>

Open in new window


fname represents the first name of a person & lname is the last name. CUrrently I have a column names "First Name" & one named "Last Name". My question is, if I create a column named "Client Name" & want to place the full name in it, how do I do that? Or in other words, how would I edit my code so it would show John Doe in the field as opposed to John in one field & Doe in another? Thanks
ASKER CERTIFIED SOLUTION
Avatar of Richard Quadling
Richard Quadling
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wantabe2

ASKER

Thanks!
Here's how I would do it:

<?php
echo "<td>", trim($row['fname'] ." ".  $row['lname']), "</td>";
?>

Open in new window


No great difference, but you won't get rogue spaces in the case of anyone with no surname, or only a surname... Just a thought.