Re: [PHP] enhanced_list_box, 2 tables from a database

2007-11-07 Thread Robin Vickery
On 07/11/2007, kNish <[EMAIL PROTECTED]> wrote:
> Hi,
>
> A newbie question. I have more than one table to access from a database.
>
> When I use the code as below, it gives no response on the web page.
>
> What may I do to run more than one table from the same database into the
> script.

Firstly, turn error reporting on, or at least look in your logs for
error messages.

Secondly, you're defining the enhanced_list_box() function twice.
That's not allowed.

-robin

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] enhanced_list_box, 2 tables from a database

2007-11-07 Thread kNish
Hi,

A newbie question. I have more than one table to access from a database.

When I use the code as below, it gives no response on the web page.

What may I do to run more than one table from the same database into the
script.

BRgds,

kNish

.
.
.
.

 
Artist
';
enhanced_list_box(array(
'table' => 'artist',
'value_field' => 'artist_name'));
function enhanced_list_box($options){
$sql = "select " . $options['value_field'];
$sql .= " from " . $options['table'];
$result = mysql_query($sql)or die("error in SQL");
echo '';
while ($row = mysql_fetch_array($result, MYSQL_NUM))
echo '' . $row[0] . '';
echo '';
}
echo '';
?>



 
Project
';
enhanced_list_box(array(
'table' => 'project',
'value_field' => 'project_name'));
function enhanced_list_box($options){
$sql = "select " . $options['value_field'];
$sql .= " from " . $options['table'];
$result = mysql_query($sql)or die("error in SQL");
echo '';
while ($row = mysql_fetch_array($result, MYSQL_NUM))
echo '' . $row[0] . '';
echo '';
}
echo '';
?>
 
.
.
.
.
.