franknu Posted January 17, 2007 Share Posted January 17, 2007 ok, i have a code that uploads multiple files it works if i use is_uploaded_file() but it send the files to diffrent rows which means i will have diffrent ID. when i use move_uploaded_file() which is the one i need then i doest upload anything iit says it did but when i look in the database there is nothing therePLEASE HELP ???[code=php:0]$uploaddir = '/home/townsfin/public_html/business_images/';$uploadfile1 = $_FILES['Picture1']['name'];if(isset ($_FILES['Picture1'])){ If (is_uploaded_file($_FILES['Picture1']['tmp_name'])&& is_uploaded_file($_FILES['Picture2']['tmp_name'])); $fullpath1 = $uploaddir . $uploadfile1; $filename1=$_POST['name']. "1"; $result= move_uploaded_file($_FILES['Picture1']['tmp_name'], $fullpath1. "$filename1"); if($result==1){ echo"picture one uploaded";}$uploadfile2= $_FILES['Picture2']['name'];$fullpath2=$uploaddir . $uploadfile2; $filename2= $_POST['name']. "2"; $result = move_uploaded_file($_FILES['Picture2']['tmp_name'], $fullpath. "$filename2"); if ($result==1) { echo"Picture2 uploaded";} If (is_uploaded_file ($_FILES['Picture1']['tmp_name']) && ($_FILES['Picture2']['tmp_name'])) { $sql="INSERT INTO `business_info`(`BusinessName`,`Slogan`,`Business_Address`,`Tel`,`Website`,`Email`, `Fax`,`type`,`make`,`Categories`,`Keyword`,`Picture1`,`Headline`,`Slogan2`,`Description1`,`Description2`,`Description3`, `Picture2`,`Picture3`,`User_Name`,`Password`)Values('$BusinessName','$Slogan','$Business_Address','$Tel','$Website','$Email','$Fax','$type','$make','$Categories','$Keyword','$fullpath1','$Headline','$Slogan2','$Description1','$Description2','$Description3','$fullpath2','$fullpath1','$User_Name','$Password')"; }}?>[/code] Link to comment https://forums.phpfreaks.com/topic/34562-files-no-being-save-in-database/ Share on other sites More sharing options...
franknu Posted January 17, 2007 Author Share Posted January 17, 2007 I had made some changes, but i haven't been able to make any progress please help i been doing this for couple of days now Link to comment https://forums.phpfreaks.com/topic/34562-files-no-being-save-in-database/#findComment-163072 Share on other sites More sharing options...
The Little Guy Posted January 17, 2007 Share Posted January 17, 2007 [CODE]<?php$sql="INSERT INTO `business_info`(`BusinessName`,`Slogan`,`Business_Address`,`Tel`,`Website`,`Email`, `Fax`,`type`,`make`,`Categories`,`Keyword`,`Picture1`,`Headline`,`Slogan2`,`Description1`,`Description2`,`Description3`, `Picture2`,`Picture3`,`User_Name`,`Password`)Values('$BusinessName','$Slogan','$Business_Address','$Tel','$Website','$Email','$Fax','$type','$make','$Categories','$Keyword','$fullpath1','$Headline','$Slogan2','$Description1','$Description2','$Description3','$fullpath2','$fullpath1','$User_Name','$Password')";mysql_query($sql)or die(mysql_error());?>[/CODE] Link to comment https://forums.phpfreaks.com/topic/34562-files-no-being-save-in-database/#findComment-163119 Share on other sites More sharing options...
franknu Posted January 17, 2007 Author Share Posted January 17, 2007 ok i addedmysql_query($sql)or die(mysql_error()); and still not sending anything to the database Link to comment https://forums.phpfreaks.com/topic/34562-files-no-being-save-in-database/#findComment-163140 Share on other sites More sharing options...
The Little Guy Posted January 17, 2007 Share Posted January 17, 2007 You never define what any of your values are, until you insert it to the database, you need to define them berfore you insert them. Link to comment https://forums.phpfreaks.com/topic/34562-files-no-being-save-in-database/#findComment-163180 Share on other sites More sharing options...
franknu Posted January 18, 2007 Author Share Posted January 18, 2007 how do i do that i thought i had define that Please help Link to comment https://forums.phpfreaks.com/topic/34562-files-no-being-save-in-database/#findComment-163851 Share on other sites More sharing options...
The Little Guy Posted January 18, 2007 Share Posted January 18, 2007 this is just an example (Ill just use your first 2), but...[code]<?php$BusinessName = $_POST['businessname'];$Slogan = $_POST['Slogan'];$sql="INSERT INTO `business_info`(`BusinessName`,`Slogan`) Values('$BusinessName','$Slogan')";mysql_query($sql)or die(mysql_error());?>[/code]or like this[code]<?php$sql="INSERT INTO `business_info`(`BusinessName`,`Slogan`) Values('{$_POST['businessname']}','{$_POST['Slogan']}')";mysql_query($sql)or die(mysql_error());?>[/code]Hope this helps Link to comment https://forums.phpfreaks.com/topic/34562-files-no-being-save-in-database/#findComment-163857 Share on other sites More sharing options...
franknu Posted January 18, 2007 Author Share Posted January 18, 2007 ok i have all that on the codes working on the page , i just didnt post it because my problems is at the uploading pictures.I think it is a move_uploaded_file()or some where around those lines Link to comment https://forums.phpfreaks.com/topic/34562-files-no-being-save-in-database/#findComment-163882 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.