hi,
i'm trying to make poll system dynamic but i got stuck somewhere .
i use:
http://www.dbscripts.net/poll/
and mostly i mess with the config.php file.
this is how the orignal looks like:
and this is what i changed it to:Code:$p = new Poll; $p->question = "place you'r vote?"; // Question displayed to the user $p->returnToURL = "../example.php"; // Specify the URL to return to for this poll; may be relative or absolute $p->legend = "title"; // Form legend; leave empty for none $p->control_type = $CONTROL_RADIOBUTTONS; // Control type; $CONTROL_RADIOBUTTONS or $CONTROL_COMBOBOX $p->add_value("1", "a"); // Poll value ID and a display string $p->add_value("2", "b"); $p->add_value("3", "c"); $p->add_value("4", "d"); $p->add_value("5", "e"); $VALID_POLLS["1"] = $p;
(the db connection and table etc work fine):
the error comes from the poll system :"wrong poll id"Code:function connectDB() { require "conf.inc"; @mysql_connect($host,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); } connectDB(); $query = "select * from poll"; $result=mysql_query($query); $p = new Poll; $p->question = "vote"; $p->legend = "title"; $p->control_type = $CONTROL_RADIOBUTTONS; while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $cityname = $row['cityname']; $numofoptions = $row['numofoptions']; $options = $row['options']; $id2=$row['id']; $id2=$id2+1; $options2=explode("," , $options); $p->add_value($id2-1,$options2[$id2-1]); } $VALID_POLLS['$id2-1'] = $p; mysql_close();
what i miss here?
thanks in advance



Reply With Quote
Bookmarks