jQuery Selects Plugin, pull variables from database -
i'm using code able generate dynamic select: demo: http://www.erichynds.com/examples/jquery-related-selects code: https://github.com/ehynds/jquery-related-selects
i have changed code of orignal script from:
$counties = array(); $counties['1']['barn'] = 'barnstable'; $counties['1']['plym'] = 'plymouth'; $counties['2']['chit'] = 'chittenden'; $counties['3']['ande'] = 'anderson';
to
$counties = array(); $sql = "select id, naam, klant_id contactpersoon order klant_id asc "; if(!$res = mysql_query($sql,$con)) { trigger_error(mysql_error().'<br />in query: '.$sql); } else { while ($row = mysql_fetch_array($res)) { $counties[$row['klant_id'][$row['id'] = htmlentities($row['naam']); } }
but reason pulldown select list not created when changes made. when test query, no errors shown.
there error, @ least in code posted. square brackets appear bit off.
$counties[$row['klant_id'][$row['id'] = htmlentities($row['naam']);
should
$counties [$row['klant_id']] [$row['id']] = htmlentities($row['naam']);
or
$a = $row['klant_id']; $b = $row['id']; $counties[a][b]= htmlentities($row['naam']);
Comments
Post a Comment