Problem with script

From: Date: Tue, 04 Apr 2000 06:51:19 +0000
Subject: Problem with script
Groups: php.version4 
Request: Send a blank email to php-version4+get-13067@lists.php.net to get a copy of this message
Hello, I'm using PHP4 on an online inventory system that I'm building in-house. I've only just started working, and I've already run into a problem. It is entirely possible that this is a newbie problem, as I'm very new to database work. Anyhow, here goes. I'm building a select box from a select query on a table. The script looks like this: <html> <head> <title>Online Inventory System: Hardware Query Builder</title> </head> <body bgcolor="white"> <?php $db = mysql_connect("---servername---", "---username---", "---password---"); mysql_select_db("gu_mgmt",$db); $result = mysql_query("SELECT * FROM SubCat",$db); ?> Select the sub-category for your query from the given values:<br><br> <FORM ACTION="gu3.php" METHOD="post"> <select name="subcats"> <option value="All"">All <?php while (mysql_fetch_row($result)){ $row = mysql_fetch_row($result); echo "<OPTION VALUE=\"$row[1]\">$row[1]"; } ?> <INPUT TYPE="submit" name="RunQuery" VALUE="Run Query"> </select> </form> </body> </html> It's a pretty simple script, which is why I can't understand what's going on. There are 30 rows in the SubCat table, but the script only returns 15 options. Very strange. The returned html looks like this. <html> <head> <title>Grand United Online Inventory System: Hardware Query Builder</title> </head> <body bgcolor="white"> Select the sub-category for your query from the given values:<br><br> <FORM ACTION="gu3.php" METHOD="post"> <select name="subcats"> <option value="All"">All <OPTION VALUE="Desktops">Desktops<OPTION VALUE="Printer">Printer<OPTION VALUE="PABX">PABX<OPTION VALUE="S/Sheets">S/Sheets<OPTION VALUE="Print Server">Print Server<OPTION VALUE="File Server">File Server<OPTION VALUE="Backup">Backup<OPTION VALUE="Word Processing">Word Processing<OPTION VALUE="File Transfer">File Transfer<OPTION VALUE="Graphics/design">Graphics/design<OPTION VALUE="Operating System">Operating System<OPTION VALUE="Equipment">Equipment<OPTION VALUE="Photocopier">Photocopier<OPTION VALUE="Exel Templates">Exel Templates<INPUT TYPE="submit" name="RunQuery" VALUE="Run Query"> </select> </form> </body> </html> Any help is appreciated. Cheers, Bradley

« previous php.version4 (#13067) next »