[PHP] Populating a list box from a database - The code

2002-12-28 Thread Denis L. Menezes
select name=OrgName[] size=5 id=OrgName ?php //connecting to the database $link = mysql_connect(localhost,lodestone,trypass); if ($link){ Print ; } else { Print No connection to the database; } if (!mysql_select_db(catapult_com)){ Print Couldn't connect

Re: [PHP] Populating a list box from a database - The code

2002-12-28 Thread Maciek Ruckgaber Bielecki
be carefull with the results of mysql_fetch_array, array names are DB field names, for easier access =) ?php //connecting to the database $link = mysql_connect(localhost,lodestone,trypass); if(!$link) Print No connection to the database; if

Re: [PHP] Populating a list box from a database - The code

2002-12-28 Thread John Nichel
$Organisation[1] is always going to be empty because you're only selecting one item per row from the DB SELECT OrgName If you want the same output in both places, just do this... echo ( option value=\$Organisation[0]\$Organisation[0]\n ); Denis L. Menezes wrote: select name=OrgName[]

Re: [PHP] Populating a list box from a database - The code

2002-12-28 Thread Denis L. Menezes
Thanks Maciek. With the code that you gave me, I am getting the error : Parse error: parse error in /usr/local/www/virtual2/66/184/35/184/html/findresults.php on line 114. My lines are as follows : $content.= option value=\.$orgData['OrgName'].\.$orgData['OrgName']./option\n); Can u help me a

Re: [PHP] Populating a list box from a database - The code

2002-12-28 Thread John Nichel
Closing parenthesis...remove it. Denis L. Menezes wrote: Thanks Maciek. With the code that you gave me, I am getting the error : Parse error: parse error in /usr/local/www/virtual2/66/184/35/184/html/findresults.php on line 114. My lines are as follows : $content.= option

Re: [PHP] Populating a list box from a database - The code

2002-12-28 Thread Paul Chvostek
I assume you want the array populated with something other than the display name in the select, so I've made up OrgId as a field name in your database. How 'bout something a little easier to read, using a more consistent style? ?php if (!$db=mysql_connect(localhost,lodestone,trypass))