Wednesday, July 8, 2009

Re: [PHP_MySQL] Need help with combo



Well, at first glance it looks like you are using the wrong operator for
concatenation.

$both[full_name] = ($row[first_name]) + ' ' + ($row[last_name]);

Should be:
$both[full_name] = ($row[first_name]) . ' ' . ($row[last_name]);

In PHP the . is the concat operator, not the +

Hope this helps,

Jason Straughan
http://tutlist.com

On Tue, Jul 7, 2009 at 9:39 PM, rsimonus <reidsim@gmail.com> wrote:

>
>
> I am trying to figure out how to get two columns into one combo. I have two
> columns. One column for first name and other columns for last name. I want
> first and last name in one combo. Here is my codes. Can someone tell me what
> went wrong?
>
> <?php
> include 'dbc.php';
>
> echo'<select name="categories">';
> $res=mysql_query("select * from missionary");
> if(mysql_num_rows($res)==0) echo "there is no data in table..";
> else
> for($i=0;$i<mysql_num_rows($res);$i++) {
> $row=mysql_fetch_assoc($res);
>
> $both[full_name] = ($row[first_name]) + ' ' + ($row[last_name]);
>
> echo"<option>$both[full_name]</option>";
>
> }
> echo'</select>';
>
> ?>
>
>
>

[Non-text portions of this message have been removed]

__._,_.___
------------------------------------------

Come to the monthly meetings at UTD in Richardson, TX.
Second Tuesday of every month.
Recent Activity
Visit Your Group
Give Back

Yahoo! for Good

Get inspired

by a good cause.

Y! Toolbar

Get it Free!

easy 1-click access

to your groups.

Yahoo! Groups

Start a group

in 3 easy steps.

Connect with others.

.

__,_._,___

0 Comments: