wierd database return

  • 18 years ago

    I have the following code, and it works great, except it returns each item 7 times.
    <?php
       $db = mysqlconnect($mysqlHost,$mysqlUser,$mysqlPass)
           or die("Failed to connect to host, {$mysqlHost}, using user name {$mysqlUser}.");
       mysql
    selectdb("php",$db)
           or die("Unable to select database 'php' on {$mysqlHost}.");
       $result = mysql
    query("SELECT ID,Name,Place,Date FROM worktimer WHERE ClockOut='00:00:00'");
       if ($result) {
           $row = mysqlfetcharray($result);
           while(next($row) != false) {
               echo "    <p><input type=\"radio\" name=\"Record\" value=\"".$row["ID"]."\">".$row["Name"]." at ".$row["Place"]." on ".$row["Date"]."<br>\r";
           }
       }
    ?>


    PLEASE HELP ME !!


    thanks, AP

  • 17 years ago

    The reason you are getting that is because you most likely have 7rows. The while you have only ends when the query returns false in your case its when it cannot find anymore records.

  • 17 years ago

    but i don't have 7 rows, there is only one.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“We better hurry up and start coding, there are going to be a lot of bugs to fix.”