Re: Combining Fields
| From: | Grae Wolfe - PHP | Date: | Wed, 31 May 2006 19:49:56 +0000 |
| Subject: | Re: Combining Fields | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-41961@lists.php.net to get a copy of this message | ||
Thank you Brad - That is what I was looking for, but now that I see how it
behaves, I am thinking that it isn't going to work the way I wanted. I need
to then be able to pass the "ID" back to MySQL so that it will retrieve just
the one record for editing.
I guess I need to go back to making the DB create an auto-incrementing ID
number. Hmmm...
Thanks!!
"Brad Bonkoski" <bbonkoski@mediaguide.com> wrote in message
news:447DF244.1070705@mediaguide.com...
>
>
> 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