newbie: MySQL importing data from a variable

From: Date: Mon, 12 Mar 2001 18:26:22 +0000
Subject: newbie: MySQL importing data from a variable
Groups: php.db 
Request: Send a blank email to php-db+get-7318@lists.php.net to get a copy of this message
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); ?>

« previous php.db (#7318) next »