foreach (glob("images/pictures/small/2007-10-18*") as $filename) { $photo_small[] .= basename($filename); } foreach (glob("images/pictures/large/2007-10-18*") as $filename2) { $photo_large[] .= basename($filename2); } $z = 0; for ($i = 560; $i < 650; $i++) { $photo_id = $i; $z = $i - 541; $g = "INSERT INTO `bmahoust_main`.`photo` ( `photo_id` , `photo_date` , `photo_name` , `photo_description` , `photo_location_large` , `photo_location_small` ) VALUES ('$photo_id', '$photo_date', '$name', '$desc', '$photo_large[$z]', '$photo_small[$z]')"; $x = mysql_query($g) or die('There was an error in your query.' . mysql_error()); }*/ for ($i = 638; $i < 666; $i++) { $j = $i + 21; $g = "INSERT INTO `ahost_main`.`photo_reference` ( `reference_id` , `reference_album_id` , `reference_category_id` , `reference_photo_id` , `reference_isvisible` , `reference_views` ) VALUES ( '$j', '1', '30', '$i', '1', '0' );"; echo $g; $x = mysql_query($g) or die('There was an error in your query.' . mysql_error()); } ?>