Wednesday, July 8, 2009

Re: [PHP_MySQL] Need help with combo



It would be helpful if you said what sort of error/problem you had,
but I think you need quotes around the parameters in $row, so:

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

otherwise they are just variables which have unset values.

James

At 03:39 08/07/2009, you 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>';
>
>?>
>
>
>
>------------------------------------
>
>------------------------------------------
>
>Come to the monthly meetings at UTD in Richardson, TX.
>Second Tuesday of every month.Yahoo! Groups Links
>
>
>
--
James Lamb

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

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: