Tuesday, 15 March 2011

php - Populating HTML 'select' drop down using sql array - Code not working -


I am using the code below to pick each individual value out of an array returned with a SQL query. When the page runs, the dropdown box pops up with the correct number of free space. 4 At the moment. However, there is no information in those places, the drop down box is populated by just 4 spaces. Any ideas ??

  Date Selection: & lt; Select name = "date selection" & gt; & Lt ;? Php $ i = 0; While ($ i & lt; $ num) {$ thedate = mysql_result (Results, $ i, 'date'); ? & Gt; & Lt; Options & gt; & Lt ;? Php echo $ thedate; ? & Gt; & Lt; / Options & gt; & Gt; & Lt ;? Php $ i ++; }? & Gt; & Lt; / Select & gt;    

You've lost a dollar sign:

 < Code> $ Thedate = mysql_result (result, $ i, 'date'); ^ - Here    

No comments:

Post a Comment