I can not figure out the code for PHP. The whole point is that you need to take information from the MS SQL server database and upload it to the site. The problem is as follows. The first photo is loaded without any problems, but if the user adds or changes it, the script does not update the photo in any way. My code is:
// Generate Picture and Thumbnail if (is_null($row['image_data'])) { $imgPath = ""; } else { $existQuery = "SELECT * FROM imagetrack WHERE pictureID = '" . $row['animal_id'] . "'"; $existResult = mysql_query($existQuery); $existCheck = mysql_fetch_array($existResult); if ($existCheck['id'] && $existCheck['stampDate'] == $row['stamp'] && file_exists("./petUploads/images/".strtolower($animalType)."/".strtolower($animalStatus)."/thumbs/".$row['animal_id'].".jpg")) { $imgPath = $row['animal_id'].".jpg"; } else { if ($existCheck['id'] && $existCheck['stampDate'] != $row['stamp']) { unlink("./petUploads/images/".strtolower($animalType)."/".strtolower($animalStatus)."/".$row['animal_id'].".jpg"); unlink("./petUploads/images/".strtolower($animalType)."/".strtolower($animalStatus)."/thumbs/".$row['animal_id'].".jpg"); } $imgPath = $row['animal_id'].".jpg"; createImage($animalType, $animalStatus, $row['image_data'], $row['animal_id']); createThumbs("petUploads/images/".strtolower($animalType)."/".strtolower($animalStatus)."/","petUploads/images/".strtolower($animalType)."/".strtolower($animalStatus)."/thumbs/",150); if (!ftp_put($ftp_conn, $ftp_root . strtolower($animalType) . "/" . strtolower($animalStatus) . "/" . $imgPath, $site_root . strtolower($animalType) . "/" . strtolower($animalStatus) . "/" . $imgPath, FTP_BINARY) || !ftp_put($ftp_conn, $ftp_root . strtolower($animalType) . "/" . strtolower($animalStatus) . "/thumbs/" . $imgPath, $site_root . strtolower($animalType) . "/" . strtolower($animalStatus) . "/thumbs/" . $imgPath, FTP_BINARY)) { if (unlink("./petUploads/images/".strtolower($animalType)."/".strtolower($animalStatus)."/".$row['animal_id'].".jpg")) { $logMsg = "Error uploading, unlinking image for ".$row['animal_id']."."; $logQuery = "INSERT INTO log (date, message) VALUES(".date('dmY h:i').", $logMsg)"; mysql_query($logQuery); } if (unlink("./petUploads/images/".strtolower($animalType)."/".strtolower($animalStatus)."/thumbs/".$row['animal_id'].".jpg")) { $logMsg = "Error uploading, unlinking thumb image for ".$row['animal_id']."."; $logQuery = "INSERT INTO log (date, message) VALUES(".date('dmY h:i').", $logMsg)"; mysql_query($logQuery); } } else { if ($existCheck['stampDate'] != $row['stamp']) { $delQuery = "DELETE FROM imagetrack WHERE pictureID = '". $row['animal_id'] . "'"; mysql_query($delQuery); } $writeQuery = "INSERT INTO imagetrack (pictureID, stampDate) VALUES ('". $row['animal_id'] . "', '" . $row['stamp'] . "')"; mysql_query($writeQuery); } } $logQuery = "INSERT INTO log (date, message) VALUES (".date('dmY h:i').", 'Animal ".$row['animal_id']." processed successfully')"; mysql_query($logQuery); } $i++; if (is_null($row['feet'])) { $declawed = "No"; } else { $declawed = $row['feet']; }