I assume you want the array populated with something other than the
display name in the , 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?
...
if ($err)
print "Database error: " . $err . "";
else {
;; "PHP general list"
<[EMAIL PROTECTED]>
Sent: Sunday, December 29, 2002 1:41 AM
Subject: Re: [PHP] Populating a list box from a database - The code
be carefull with the results of mysql_fetch_array, array names are DB
field names, for easier access =)
";
while($o
little bit more?
Thanks
denis
- Original Message -
From: "Maciek Ruckgaber Bielecki" <[EMAIL PROTECTED]>
To: "Denis L. Menezes" <[EMAIL PROTECTED]>
Cc: "Justin French" <[EMAIL PROTECTED]>; "PHP general list"
<[EMAIL PROTECTED]>
Se
$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 ( "$Organisation[0]\n" );
Denis L. Menezes wrote:
$link = mysql_connect("localhost","lod
be carefull with the results of mysql_fetch_array, array names are DB
field names, for easier access =)
";
while($orgData=mysql_fetch_array($result))
{
// note that OrgName is the field name in the database.
// for value you may use the org_id instead, if you have one in the
\n";
}
$sql="SELECT OrgName From TableResults ORDER BY OrgName";
$result=mysql_query($sql);
While($Organisation=mysql_fetch_array($result))
{
Print("$Organisation[1]\n");
}
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.
6 matches
Mail list logo