Re: Combining Fields

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





Grae Wolfe - PHP wrote:

Good Day!
I am trying to use my limited knowledge to create a VERY simple process to display some of the information in my table, allow a particular record to be selected, then opened on a page with text boxes to edit the information, after which the UPDATE command will be used to update the database. That being said, I have a way that I think this will work, but I don't have a unique record number in my table for each of the entries. I have tried getting PHPMyAdmin to set this up, but I cannot seem to make it work. SO - I need to try to create that ID on the fly. I figured I could just combine the first and last names to make this ID, but I am not sure what the syntax should be. Here is the code I have dealing with defining the variables...

Any help or thoughts would be splendid!

while ($row = mysql_fetch_array($result)) {
$id = $row['last_name'],$row['first_name'];
$fname = $row['first_name'];
$lname = $row['last_name'];

$option_block .= "<option value=\"$id\">$lname, $fname</option>";


Use the dot (.) for appending variables...
so it would be:
$id = $row['last_name'].$row['first_name'];
...or course if you want that would look like this: 'SmithAdam'
if you want 'Smith,Adam' as your id then:
$id = $row['last_name'].",".$row['first_name'];
-Brad

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux