I am modifiying some templates and scripts used in the vbulletin message board system. The php scripts call in the needed templates and process them via an "eval" function.
I'm trying to modify a template to include a select button that is derived from the contents of a db. I have included the following at the beginning of the php script that calls the template:
####1#########
$citydata = mysql_fetch_array($cities);
#############
As a test, the following is included in the php script to test the validity of the connection. It works:
####2#########
?>
<SELECT NAME="city">
<? while($data = mysql_fetch_array($cities)) {
echo("
<OPTION>$data[state] - $data[cityname]
"); } ?>
</SELECT>
<?
#############
Of course, the above puts the select menu in an inappropriate place, but it was just a test.
Therefore, on the template, I've added this:
####3#########
<SELECT NAME="clubcity">
while($citydata = mysql_fetch_array($cities))
<OPTION>$citydata[state] - $citydata[cityname]
</SELECT>
#############
That code produces a select menu with only the first item in the array. It's accessing the db, but not creating the entire dropdown menu.
The line in the php script that calls in the template is this:
####4#########
eval("dooutput(\"".gettemplate("memberlistcitysearch")."\");");
#############
The following is the code output on the html page produced:
####5#########
<SELECT NAME="clubcity">
while(Array = mysql_fetch_array(Resource id #2))
<OPTION>AB - Alberta General
</SELECT>
#############
Clearly, I have either forgotten something in the coding of #3# above, or the eval function in #4# is doing something I don't understand. Or both, since by now my eyes are really crossed.
Thanks in advance,
Paul Cardin