Page 1 of 1

how to concatenate two fields in a list box

Posted: Fri Jul 12, 2013 5:21 am
by cincihal
I have a list box of last names and I would like to concatenate a ", " and first name at the end of the last name. Can someone show me how to do this? This is what I have for last name:

Code: Select all

function query() {
		$myData = mysql_query("SELECT * FROM clients ORDER BY Lname1");
		while($record = mysql_fetch_array($myData)) {
			echo '<option value="' . $record['Lname1'] . '">' . $record['Lname1'] . '</option>';
		}

Re: how to concatenate two fields in a list box

Posted: Sat Jul 13, 2013 6:10 am
by johnj

Code: Select all

echo '<option value="' . $record['Fname1'].",".$record['Lname1'] . '">' . $record['Lname1'] . '</option>';