PDA

View Full Version : [Solved] print_select_row() question


Fargo
11-19-2004, 03:05 AM
im trying to use the print_select_row function, but I don't seem to be doing it correctly.

my understanding from the syntax, is that its basically the same as all other input commands, with the acception of the array parameter, and that seems to be my biggest problem.

when using this command, how would I properly pass the array to the function from the results of a query?

I've tried


$getids = $DB_site->query("SELECT siteid FROM " . TABLE_PREFIX . "sites");
$idarray = $DB_site->fetch_array($getids);

print_select_row("Siteid", 'siteid', $idarray);


and

$getids = $DB_site->query("SELECT siteid FROM " . TABLE_PREFIX . "sites");

print_select_row("Siteid", 'siteid', $getids);


but none of this seems to do anything.

Anyone have any ideas on this one?

Fargo
11-20-2004, 12:38 AM
still no luck getting this to work. I can do it with a static array, but not one from a query.

If anyone has any idea, please share them

Fargo
11-20-2004, 03:49 PM
Well, after SEVERAL hours of trying to figure it out, I FINALLY got it!

In case anyone else cares, this is the code from calandarpermission.php that will allow you to generate an array which can be passed as a variable in print_select_row(title, $name, $array, $selected = '', $htmlise = 0, $size = 0, $multiple = false)

on an unmodified calendarpermission.php, youll find this around line 236

// Calendar cache, will move to function...
$calendars = $DB_site->query("SELECT calendarid, title FROM " . TABLE_PREFIX . "calendar ORDER BY displayorder");
$calendarcache = array();
while ($calendar = $DB_site->fetch_array($calendars))
{
$calendarcache["$calendar[calendarid]"] = $calendar['title'];
}
unset($calendar);
$DB_site->free_result($calendars);


all you have to do is modify the variables and SQL statement within this code to your need and then use the new array (calendarcache in the above code).

Wish someone woulda told me this before I spent 1/2 the weekend figuring it out :( ..but I guess I learned something :)...