Jump to content

updating mysql database with fields in loop


brem13

Recommended Posts

ok, another question, sorry.

im still kind of new to this kind of stuff.

i have a script that will loop through a folder and display all the pictures in that folder, all of those pictures filenames are in a mysql database with comment fields. im trying to update the comments in the mysql database when i click on update with all the update comments. but it doesnt do anything. i think it has something to do with the files being looped and put in arrays. anyone have any pointers for me please?

here is the script that is  looping through the directory,displaying the pictures on the page with the comment textbox underneath, and the form to update the mysql database. any help at all will be greatly appreciated

------------------------------------------------------------------------------------------

if ($handle = opendir($cwd)) 
{
   /* Read file names */
   while (false !== ($file = readdir($handle))) 
    {

          if (true == is_dir("$cwd$file")) 
         {
      } else 
         { if(true == is_img($cwd.$file))
            {
             $c++;
             
            echo '<td align=center>';
              echo '<a href="'.$cwd.'/'.$file.'"><img src="'.$cwd.'/thumbs/'.$file.'"></a><br>';

?>
<form name="comments" action="editgall.php" method="POST">
<font face="tahoma" size="1">Edit: </font>
<input type="text" name="comment[]" id="comment1" value="<?php
include("../../../../configpic.php");
mysql_connect($server, $db_user, $db_pass) or die (mysql_error()); 
$result = mysql_db_query($database, "SELECT * FROM $pwd WHERE picture='$file'") or die (mysql_error()); 

   while ($qry = mysql_fetch_array($result)) { 
      echo "$qry[comment]"; 
   } 
?>">
<?
           //  echo "<br>".$file."<br>\n";
              echo '</td>';
              if ($c==4) { echo '</tr><tr>'; $c=0;} 
             }
         }

   }
   closedir($handle);
}
echo '</tr></table>';
   ?>
<input type="submit" name="submit" value="update">
</form>Report to moderator    207.127.128.2 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.