mikebyrne Posted March 19, 2008 Share Posted March 19, 2008 At present my dropdownlist isnt filling up with the values from my database field I'm just getting the following output on screen include('adminconnect.php'); $query = "SELECT ProductName FROM Product; $result = mysql_query($query) or die (mysql_error()); My code is: <form> <!-- logo start --> <div id="container"> <div class="padTop28"><!-- --></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <!-- logo finish --> <!-- menu start --> <div id="container"> <div id="menu1"> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/start.php" class="black">Order</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_on"><!-- --></div> <div id="menu_text_on"><a href="../admin_files/sales.php" class="black_on">Sales</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/list.php" class="black">Edit item</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/sales.php" class="black">Postage fee</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/adminreg.php" class="black">Add User</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/add.php" class="black">Add Product</a></div> <div id="menu_space1"><!-- --></div> </div> <div class="clr"><!-- --></div> <div class="clr"><!-- --></div> <div class="padTop5"><!-- --></div> <div class="clr"><!-- --></div> <div id="dotted"><!-- --></div> <div class="clr"><!-- --></div> <div class="padTop5"><!-- --></div> <div class="clr"><!-- --></div> <div id="menu2"> <div id="menu_hide"><!-- --></div> <div id="menu_text_off" class="textWhite">order</div> <div id="menu_space1"><!-- --></div> <div id="menu_hide"><!-- --></div> <div id="menu_text_off"><a href="sales.php" class="black">Sales</a></div> <div id="menu_space2"><!-- --></div> <div id="menu_text_on"><a href="sales_search.php" class="black_on">Sales search</a></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <div class="padTop38"><!-- --></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <!-- menu finish --> <!-- top start --> <div id="container"> <div id="line"><!-- --></div> </div> <div class="clr"><!-- --></div> <div id="containerBg1"> <div class="padTop15"><!-- --></div> <div class="clr"><!-- --></div> <div id="titleText">sales search</div> <div class="clr"><!-- --></div> <div class="padTop15"><!-- --></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <!-- top finish --> <!-- 1px space start --> <div id="containerBg1"> <div class="padTop1"><!-- --></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <!-- 1px space finish --> <!-- data top start --> <div id="containerBg3"> <div class="padTop1"><!-- --></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <!-- data top finish --> <!-- data content start --> <div id="containerBg4"> <!-- data start --> <div class="padTop11"><!-- --></div> <div class="clr"><!-- --></div> <div class="padTop1"> <table width="850" border="0" cellspacing="0" cellpadding="0"> <tr align="left"> <td width="33"> </td> <td width="55">month</td> <td width="762"> <select name="month" class="000"> <option value="">------</option> <option value="2006-06" >2006-06</option> <option value="2006-05" >2006-05</option> <option value="2006-04" >2006-04</option> <option value="2006-03" >2006-03</option> <option value="2006-02" >2006-02</option> <option value="2006-01" >2006-01</option> <option value="2005-12" >2005-12</option> </select> </td> </tr> </table> </div> <div class="clr"><!-- --></div> <div class="padTop11"><!-- --></div> <div class="clr"><!-- --></div> <!-- data finish --> <!-- data start --> <div class="padTop1"> <table width="850" border="0" cellspacing="0" cellpadding="0"> <tr align="left"> <td width="33"> </td> <td width="55">year</td> <td width="762"> <select name="year" class=""> <option value="">------</option> <option value="2006" >2006</option> <option value="2005" >2005</option> </select> </td> </tr> </table> </div> <!-- data finish --> <!-- line start --> <div class="clr"><!-- --></div> <div class="padTop11"><!-- --></div> <div class="clr"><!-- --></div> <div id="dottedIn"><!-- --></div> <div class="clr"><!-- --></div> <div id="sales_text_and">and / or</div> <div id="dottedIn"><!-- --></div> <div class="clr"><!-- --></div> <div class="padTop11"><!-- --></div> <div class="clr"><!-- --></div> <!-- line finish --> <!-- data start --> <div class="padTop1"> include('adminconnect.php'); $query = "SELECT ProductName FROM Product; $result = mysql_query($query) or die (mysql_error()); <table width="850" border="0" cellspacing="0" cellpadding="0"> <tr align="left"> <td width="33"> </td> <td width="55">product</td> <td width="762"> <select name="month"> <option value="">------</option> <?PHP $i=1; while ($row = mysql_fetch_array($query)) { echo "<option value=\"$i\" >".$row['ProductName']."</option>"; $i++; } ?> </select> </td> </tr> </table> </div> <div class="clr"><!-- --></div> <div class="padTop11"><!-- --></div> <div class="clr"><!-- --></div> <div id="dottedIn"><!-- --></div> <div class="clr"><!-- --></div> <!-- data finish --> <!-- btn start --> <div class="padTop16"><!-- --></div> <div class="clr"><!-- --></div> <div id="btn"><a href="sales_search_result.php"><img src="../images/btn_search.gif" alt="search" width="73" height="23" border="0" /></a></div> <div class="clr"><!-- --></div> <div class="padTop16"><!-- --></div> <div class="clr"><!-- --></div> <!-- btn finish --> </div> <div class="clr"><!-- --></div> <!-- data content finish --> <!-- data btm start --> <div id="containerBg3"> <div class="padTop1"><!-- --></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <!-- data btm finish --> <!-- btm start --> <div id="containerBg1"> <div class="padTop15"><!-- --></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <div id="container"> <div id="line"><!-- --></div> </div> <div class="clr"><!-- --></div> <div class="padTop16"><!-- --></div> <div class="clr"><!-- --></div> <!-- btm finish --> </form> Quote Link to comment Share on other sites More sharing options...
revraz Posted March 19, 2008 Share Posted March 19, 2008 I dont see where you start <?php before your include. Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 19, 2008 Author Share Posted March 19, 2008 My code looks like this: <?php include('adminconnect.php'); $query = "SELECT ProductName FROM Product; $result = mysql_query($query) or die (mysql_error()); ?> <table width="850" border="0" cellspacing="0" cellpadding="0"> <tr align="left"> <td width="33"> </td> <td width="55">product</td> <td width="762"> <select name="month"> <option value="">------</option> <?PHP $i=1; while ($row = mysql_fetch_array($query)) { echo "<option value=\"$i\" >".$row['ProductName']."</option>"; $i++; } ?> </select> </td> </tr> </table> But still getting the same error Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.