ODP: [PHP4BETA] Problem with script
| From: | Paweł Szczerba | Date: | Tue, 04 Apr 2000 06:48:27 +0000 |
| Subject: | ODP: [PHP4BETA] Problem with script | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-13068@lists.php.net to get a copy of this message | ||
Check in the manual:
Subsequent call to mysql_fetch_row() would return the next row in the
result set, or false if there are no more rows.
> -----Oryginalna wiadomość-----
> Od: Bradley [SMTP:mccroreyb@linux.com]
> Wysłano: 4 kwietnia 2000 08:51
> Do: php4beta@lists.php.net
> Temat: [PHP4BETA] Problem with script
>
> 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
> << Plik: ATT00002.htm >>
Paweł Szczerba
mailto:pawel.szczerba@ksconsulting.com.pl