This code is the last lines in an upload script that uploads 4 images at the same time and writes the url to these and som other information to the database.
database structure: id img1 img2 img3 img4 imageobject imageinfo imagecategory
The problem is that im trying to write an array on $destination so i can insert the urls as below: IMG1= $destination[1] and so on. the example below writes the same url four times insted of every files url one time.
imagedestroy($src);
imagedestroy($tmp); // NOTE: PHP will clean up the temp file it created when the request
// has completed.
echo "Successfully Uploaded: ".$filename."
";
}
if(isset($_POST[submit])){
$imgNumb=1; //This the "pointer" to images
$DestinationDir="images/gallery/"; //Place the destination dir here
while ($_FILES["img".$imgNumb][tmp_name]){
$Unique=microtime(); // unique names
$destination=$DestinationDir.md5($Unique).".jpg";
imgReisize($_FILES["img".$imgNumb][tmp_name], $destination);
$imgNumb++;
}
$destination = array(1 => $destination, 2 => $destination, 3 => $destination, 4 => $destination);
include("includes/connect_database.php");
$sql = mysql_query("INSERT INTO test (img1, img2, img3, img4, imageobject, imageinfo, imagecategory) values ('$destination[1]', '$destination[2]', '$destination[3]', '$destination[4]', '$_POST[imageobject]','$_POST[imageinfo]','$_POST[imagecategory]')");
mysql_close()
Help with parsing this html
Hi, I've got some html i just need a couple of strings from.. argh, it's freaking me out. I've tried a lot.Here is the html:Code: <div id="Tab01" style="overflow: auto;
date function help
i need help with date functionCode: [Select]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
Problem with PHP/mySQL login code
Hello,There is an error in my login script and I can't figure out what it is...I believe it might be my "SELECT" statement...Can anyone help me? Code: <?php//define ('SASI Services
Question handling xml data
Hello, I have sucessfull followed this tutorialhttp://www.phpfreaks.com/tutorial/handling-xml-dataand used xpath to find the books I need, here is my codeCode: [Select]<?php// load
dynamic table with forms
I have a table that is populated with mysql data and in teh first column there is a raido button that i would like to have it when selected and i hit either edit or delete the ID is passed to another
ctype() validation - allowing illegal characters
Hello,I use ctype() to filter and validate a user form. However, I am trying to allow certain characters.Example:Code: //Validate Copay $allow = array('$', '.'); if (!empty($copay)
Can php detect connection speed and thereafter swap out elements?
No code to post, lads, yet. Just looking for a yay or nay at this stage:Can a php script be written to make a judgement call on whether or not to display a flash animation or *jpeg based on a
Help pulling in 'id' with "read more" link
I'm trying to create snippets of my articles in the cms I'm creating, and then have them redirect to to a single page entry of the article. Right now my snippets and "read more" links are
Query failed issue with php script but works fine in mssql manager!
hi i have the script below which copies data from one table to another but will only insert new data update current data or delete old data from tempproducts to products then it will delete the
Function to extract email attachments using PHP IMAP
function extract_attachments($connection, $message_number) { $attachments = array(); $structure = imap_fetchstructure($connection, $message_number); if(isset($structure->parts)