MySQL Forums
Forum List  »  PHP

update blob isn't working
Posted by: Adrian Marriage
Date: December 31, 2008 06:56AM

Hi some help here would be appreciated my update isn't working everything in this statement updates except $file1 $file2 which are blob fields. After the update they just stay as [BLOB 0]??

in the table zloads data2 and thumbnail2 etc are longblobs
AI have been searching online all day to find out something about this but can't find anything I guess here is the last stop.
I am sure my coding is not good I am quite new to php.

<? 
ini_set ("display_errors", "1");
error_reporting(E_ALL);
session_start();
error_reporting(7);
require("../global/admin_functions.php");


$sid = $_SESSION['LOGINID'];
if($sid!="")

{           
            $action = $_POST["action"];
	      if($action=="")
		$action = $_GET["action"];
 $sql = "SELECT * FROM zloads WHERE intProductID='$id'";
	$temps  = $DB_site->query($sql);
	if($row=$DB_site->fetch_array($temps))
	{
$description1         = $row["description1"];
$data1                = $row["data1"];
$filename1            = $row["filename1"];
$filesize1            = $row["filesize1"];
$filetype1            = $row["filetype1"];
$thumbnail1           = $row["thumbnail1"];
$thumbnailtype1       = $row["thumbnailtype1"];
$description2         = $row["description2"];
$data2                = $row["data2"];
$filename2            = $row["filename2"];
$filesize2            = $row["filesize2"];
$filetype2            = $row["filetype2"];
$thumbnail2           = $row["thumbnail2"];
$thumbnailtype2       = $row["thumbnailtype2"];
$description3         = $row["description3"];
$data3                = $row["data3"];
$filename3            = $row["filename3"];
$filesize3            = $row["filesize3"];
$filetype3            = $row["filetype3"];
$thumbnail3           = $row["thumbnail3"];
$thumbnailtype3       = $row["thumbnailtype3"];
$description4         = $row["description4"];
$data4                = $row["data4"];
$filename4            = $row["filename4"];
$filesize4            = $row["filesize4"];
$filetype4            = $row["filetype4"];
$thumbnail4           = $row["thumbnail4"];
$thumbnailtype4       = $row["thumbnailtype4"];

}

	if($action=="delete1")
	{
		$id = $_GET["id"];
		if($id!="")
		{

$sql01 = "update zloads set description1 = '',data1 = '', filename1 = '', filesize1 = '', filetype1 = '', thumbnail1 = '', thumbnailtype1= '' where intProductID='$id'";


$file1 = addslashes(fread(fopen($data2,0,"data2")));
$file2 = addslashes(fread(fopen($thumbnail2,0,"thumbnail2")));
$sql02 = "update zloads set description1 = '$description2', data1 = '$file1', filename1 = '$filename2', filesize1 = '$filesize2', filetype1 = '$filetype2', thumbnail1 = '$file2', thumbnailtype1= '$thumbnailtype2' where intProductID='$id'";




			
                $DB_site->query($sql01);
                $DB_site->query($sql02);

		    header("Location:updatepix.php?adid=$id");
		    exit;
			
		}
	}	
}
?>

Options: ReplyQuote


Subject
Written By
Posted
update blob isn't working
December 31, 2008 06:56AM
January 30, 2009 12:52AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.