Gavin.

Try this - put a counter in you loop, and echo the counter along wiht 
$file. I would wager that your last value for file is "". (I didn't 
carefully check your logic.)

More to the point, you aren't accumulating the file names in $file. As an 
experiment, try adding
$filelist ,= $file; before the echo statement, also echo $filelist to see 
how it builds. If it is doing what you want, then substitute it for $file 
in your update statement.

REgards - Miles Thompson


At 10:26 AM 3/12/01 -0800, Gavin Tong wrote:
>Hi, I've been trying to get this script to read a directory and then pass 
>the information into a Mysql table.  I can open the directory and print 
>it's contents, or I can get other information from variables passed to the 
>mysql table, but I can't seem to do both.  If you have any idea what I've 
>done wrong or have an idea where I can read more about this problem your 
>thoughts will be greatly appreciated.
>Sincerely,
>Gavin Tong
>
><?php
>$handle=opendir('.');
>while (false!==($file = readdir($handle))) {
>     if ($file != "." && $file != "..") {
>         echo "$file\n";
>     }
>}
>closedir($handle);
>$db = mysql_connect("local host", "person", "pasword");
>mysql_select_db("photos",$db);
>$result = mysql_query("insert into template (name) values 
>('$file')",$db);
>?>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to