This is the other code that works on the same server. <?php if (isset($_POST['submit'])) { $caption=($_POST['caption']); $description=($_POST['description']); $image_file=($_FILES['image_file']); $where_taken=($_POST['where_taken']); $fox=($_POST['fox']); $wolves=($_POST['wolves']); $wildlife=($_POST['wildlife']); $scenic=($_POST['scenic']); $birds=($_POST['birds']); $eagles=($_POST['eagles']); $deer=($_POST['deer']); $small_mammals=($_POST['small_mammals']); $large_mammals=($_POST['large_mammals']); $dogs=($_POST['dogs']); $cats=($_POST['cats']); $flowers=($_POST['flowers']); $insects=($_POST['insects']); $bear=($_POST['bear']); $moose=($_POST['moose']); $image_file = $_FILES['image_file']['name']; $image_type = $_FILES['image_file']['type']; $image_size = $_FILES['image_file']['size']; include('includes/connect_local.inc.php'); if(image_size > 3000000) { class ImgResizer { private $originalFile = ''; public function __construct($originalFile = '') { $this -> originalFile = $originalFile; } public function resize($newWidth, $targetFile) { if (empty($newWidth) || empty($targetFile)) { return false; } $src = imagecreatefromjpeg($this -> originalFile); list($width, $height) = getimagesize($this -> originalFile); $newHeight = ($height / $width) * $newWidth; $tmp = imagecreatetruecolor($newWidth, $newHeight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height); if (file_exists($targetFile)) { unlink($targetFile); } imagejpeg($tmp, $targetFile, 85); // 85 is my choice, make it between 0 - 100 for output image quality with 100 being the most luxurious } } } if (!empty($caption) && !empty($image_file)) { if (($image_type == 'image/gif') || ($image_type == 'image/jpeg') || ($image_type == 'image/pjpeg') || ($image_type == 'image/png') && ($image_size < 3000000)) { if ($_FILES['image_file']['error'] == 0) { // Move the file to the target upload folder $target = 'images/' . $image_file; if (move_uploaded_file($_FILES['image_file']['tmp_name'], $target)){ $batchconnection; $sqlStatements = "INSERT INTO images(caption, where_taken,description, image_file) VALUES ('$caption','$where_taken','$description','$image_file'); INSERT INTO keywords (image_id,fox, wolves, wildlife, scenic, birds, eagles, deer, small_mammals, large_mammals, dogs, cats, flowers, insects, bear, moose) VALUES('','$fox','$wolves','$wildlife','$scenic','$birds','$eagles','$deer', '$small_mammals', '$large_mammals','$dogs', '$cats', '$flowers', '$insects', '$bear', '$moose')"; $sqlResult = $batchconnection->multi_query($sqlStatements); if($sqlResult == true) { echo "Successfully Inserted Records"; } else { echo "Some Error Occured While Inserting Records"; } mysqli_close($batchconnection); } } } } } ?> "Ashley Sheridan" <ash@xxxxxxxxxxxxxxxxxxxx> wrote in message news:1272674704.9998.11.camel@xxxxxxxxxxxx > On Fri, 2010-04-30 at 20:43 -0400, Gary wrote: > >> I have this duplicate code on another site and it works fine. The image >> is >> uploaded to the images folder, the information is not submitted to the >> database. I get the error >> >> Some Error Occured While Inserting Records >> >> This is only on a local machine so I have not yet included and safegaurds >> like stripslashes or my_real_escape_string. >> >> Thanks for your help >> >> Gary >> >> <?php >> if (isset($_POST['submit'])) { >> $manufacturer=($_POST['manufacturer']); >> $type=($_POST['type']); >> $model=($_POST['model']); >> $caliber=($_POST['caliber']); >> $condition=($_POST['condition']); >> $price=($_POST['price']); >> $description=($_POST['description']); >> $image_file_name=($_POST['image_file_name']); >> $image_file=($_FILES['image_file']); >> $available=($_POST['available']); >> >> $image_file = $_FILES['image_file']['name']; >> $image_type = $_FILES['image_file']['type']; >> $image_size = $_FILES['image_file']['size']; >> >> include ('includes/connect_local.inc.php'); >> >> if(image_size >3000000) { >> >> class ImgResizer { >> private $originalFile = 'image_file'; >> public function __construct($originalFile = 'image_file') { >> $this -> originalFile = $originalFile; >> } >> public function resize($newWidth, $targetFile) { >> if (empty($newWidth) || empty($targetFile)) { >> return false; >> } >> $src = imagecreatefromjpeg($this -> originalFile); >> list($width, $height) = getimagesize($this -> originalFile); >> $newHeight = ($height / $width) * $newWidth; >> $tmp = imagecreatetruecolor($newWidth, $newHeight); >> imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newWidth, $newHeight, >> $width, >> $height); >> if (file_exists($targetFile)) { >> unlink($targetFile); >> } >> imagejpeg($tmp, $targetFile, 85); // 85 is my choice, make it between >> 0 - >> 100 for output image quality with 100 being the most luxurious >> } >> } >> } >> if (!empty($type) && !empty($image_file)) { >> if (($image_type == 'image/gif') || ($image_type == 'image/jpeg') >> || >> ($image_type == 'image/pjpeg') || ($image_type == 'image/png') && >> ($image_size <3000000)) { >> if ($_FILES['image_file']['error'] == 0) { >> // Move the file to the target upload folder >> $target = 'images/' . $image_file; >> if (move_uploaded_file($_FILES['image_file']['tmp_name'], >> $target)){ >> $batchconnection; >> >> $sqlStatements = "INSERT INTO guns( id,manufacturer, type, model, >> caliber, condition, price, description, image_file_name,submitted >> ,available) VALUES ('','$manufacturer', '$type', '$model', '$caliber', >> '$condition', '$price', '$description','$image_file_name', ' ', >> '$available'); >> >> INSERT INTO images (id, image_file) VALUES('','$image_file')"; >> >> $sqlResult = $batchconnection->multi_query($sqlStatements); >> if($sqlResult == true) { >> echo "Successfully Inserted Records"; >> } else { >> echo "Some Error Occured While Inserting Records"; >> } >> >> >> >> } >> >> } >> } >> } >> mysqli_close($batchconnection); >> } >> ?> >> >> >> >> __________ Information from ESET Smart Security, version of virus >> signature database 5076 (20100430) __________ >> >> The message was checked by ESET Smart Security. >> >> http://www.eset.com >> >> >> >> >> > > > Is it possible that this server doesn't like batch queries? Try > splitting them out into individual queries and seeing if that helps. If > that doesn't do the trick, print out the SQL query string to see if it's > what you expect. It might be working fine on the other server, but I've > seen enough strange things happen before to know that sometimes 'poo' > happens. > > Thanks, > Ash > http://www.ashleysheridan.co.uk > > > > > > __________ Information from ESET Smart Security, version of virus > signature database 5076 (20100430) __________ > > The message was checked by ESET Smart Security. > > http://www.eset.com > > __________ Information from ESET Smart Security, version of virus signature database 5076 (20100430) __________ The message was checked by ESET Smart Security. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php