I don't understand.
I am able to get as far as the copy command in this script, which is good...
But I cannot(!) make get the name of the image to write to the database.
It's pretty much the final piece of my project and it is super frustrating to be stuck on such a nit picky little piece.
The upload fields are titled 'imagefield1' and 'imagefield2'
But the value going to the database is defaulted at 'None'
The best I have been able to do it to make the 'None' in one of the fields turn to a 0, and it's not an INT field.
Can anyone help?
Code: Select all
$sql = "SELECT
Spk_ID,
Spk_FName, Spk_LName
FROM speaker WHERE
Spk_FName='".str_replace("'","'",$_POST["fname"])."' AND Spk_LName='".str_replace("'","'",$_POST["lname"])."'";
if(!$result = mysql_query($sql))
{
echo mysql_error();
echo "error on select";
}
$speakerresults = mysql_fetch_array($result);
$speakerid = $speakerresults["Spk_ID"];
//setcookie ("Spk_ID", $speakerid);
mkdir("Imi/Spk_Img/".$speakerid);
$Spk_Logo = $speakerresults["Spk_Logo"];
$Spk_Image = $speakerresults["Spk_Image"];
foreach( $HTTP_POST_FILES as $aFile )
{
if ($aFile['type'] == "image/gif" || $aFile['type'] == "image/jpeg" || $aFile['type']=="image/pjpeg")
{
copy ($aFile['tmp_name'], "Imi/Spk_Img/".$speakerid."/".$aFile['name'])
or die ("Could not copy");
echo "";
//$picname=$aFile['name'];
}
}
$sql = "UPDATE speaker SET Spk_Logo = '".$Spk_Logo."' AND Spk_Image = '".$Spk_Image."' WHERE Spk_ID=".$speakerid;
$results = mysql_query($sql) or die (mysql_error());Code: Select all
$Spk_Logo = $speakerresults["Spk_Logo"];
$Spk_Image = $speakerresults["Spk_Image"];Thanks so much for your help.