So I'm trying to transfer a longblob from one data table to another. All the other data is transferring however the longblob isn't. I know it is getting up loaded to the temp table because the longblob column show s there is data in it.
here is the snippet of code i'm using to upload the data (connection info removed)
$link = mysql_connect($host, $username, $password);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db ($database);
$confirmcode = md5(uniqid(rand()));
$title = $_POST ['title'];
$price = $_POST ['price'];
$listdesc = $_POST ['listdesc'];
$email = $_POST ['email'];
$retype = $_POST ['retype'];
$date = date("Y-m-d");
if (isset($_FILES['image']) && $_FILES['image']['size'] > 0) {
$tmpName = $_FILES['image']['tmp_name'];
$fp = fopen($tmpName, 'r');
$data = fread($fp, filesize($tmpName));
$data = addslashes($data);
fclose($fp);
$sql="INSERT INTO temptumisc (confirmcode, title, price, listdesc, email, retype, image , date) VALUES ('".$confirmcode."', '".$title."', '".$price."', '".$listdesc."', '".$email."', '".$retype."', '".$data."', '".$date."')";
$result=mysql_query($sql);
}
and here is the code for the transfer that isn't working....
<?
include('connect.php');
$passkey=$_GET ['passkey'];
$tbl_name1="temptumisc";
$sql1="SELECT * FROM $tbl_name1 WHERE confirmcode ='".$passkey."'";
$result1=mysql_query($sql1);
if ($result1){
$count=mysql_num_rows ($result1);
if ($count==1) {
$rows=mysql_fetch_array($result1);
if (isset($_FILES['image']) && $_FILES['image']['size'] > 0) {
$tmpName = $_FILES['image']['tmp_name'];
$fp = fopen($tmpName, 'r');
$data = fread($fp, filesize($tmpName));
$data = addslashes($data);
fclose($fp);
}
$title = $rows['title'];
$price = $rows['price'];
$listdesc = $rows['listdesc'];
$email = $rows['email'];
$retype = $rows['retype'];
$date = date("Y-m-d");
$tbl_name2="tumisc";
$sql2="INSERT INTO $tbl_name2 (title, price, listdesc, email, retype, image, date) VALUES ('".$title."', '".$price."', '".$listdesc."', '".$email."', '".$retype."', '".$data."', '".$date."')";
$result2=mysql_query($sql2);
}
Last question I asked was answered immediately and I was able to figure it out from there. Hope it'll happen again. Any help or pointers will be greatly apreciated because I am self-teaching.