wierd database return

  • 18 years ago

    I have the following code, and it works great, except it returns each item 7 times.
       $db = mysqlconnect($mysqlHost,$mysqlUser,$mysqlPass)
           or die("Failed to connect to host, {$mysqlHost}, using user name {$mysqlUser}.");
           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";


    thanks, AP

  • 18 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.

  • 18 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).


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.

“It works on my machine.” - Anonymous