[SOLVED] value not getting passed to function variable

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
drmsolutions
Forum Newbie
Posts: 5
Joined: Sat Mar 06, 2004 11:03 pm

[SOLVED] value not getting passed to function variable

Post by drmsolutions »

Hi there,

I'm passing values to a function, but am finding the value of 'highlight_id' below is not set. I'm only new to PHP so am thinking I've done something wrong, but can't work out what?

Code: Select all

<? enhanced_list_box(array(
 'table'        => 'ctitle',
 'id_field'     => 'id',
 'value_field'  => 'title',
 'highlight_id' => $Resultset['Title']));
?>

$Resultset['Title'] definitely has a value, as I've printed it to test, but 'highlight_id' has not been set to the same value as $Resultset['Title'].
$Resultset['Title'] is set further up in the script:

Code: Select all

$Resultset = $MyDb->f_GetRecord($Result);
I actually got this script from someone else and they originally set 'highlight_id' => 4
I'm changing it as I want the listbox to select the value that is contained in the record it has retrieved rather than a static value.
I hope that makes sense?
Last edited by drmsolutions on Sun Mar 07, 2004 2:32 pm, edited 1 time in total.
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Before continuing, did you notice that you missed out a ' before the first table' posted above?
drmsolutions
Forum Newbie
Posts: 5
Joined: Sat Mar 06, 2004 11:03 pm

Post by drmsolutions »

oops...sorry...have fixed it now...
It was in my original code, just didn't come over in the copy and paste.
Thanks...

Unfortunately that wasn't the problem :(
drmsolutions
Forum Newbie
Posts: 5
Joined: Sat Mar 06, 2004 11:03 pm

Post by drmsolutions »

Its all fixed now. The variable was losing scope in the fuction, so I used a GLOBAL variable and its working now!
Post Reply