Reply to I can't insert a blob value in MySQL

Your name:

Reply:


Posted by cricrin on 03/05/07 23:41

Hello guys!
This is Cristian From Argentina, and I wanted to ask you some help,
I've looking on this and it makes me mad, I found that the error is in
the $content , when y try to insert the record into the table via PHP
code i receive an error message saying that the sin taxis its
incorrect,however if i print the query echo ($query) and i copy and
paste the query in the PHPmyAdmin the insert executes successfully.

the $content variable contents the binary part of the file, in fact
the file

I'm pretty sure that the issue is with the $content variable via PHP
since , if i omit this field

the query via PHP executes successfully.

I've included a part of the code, the Table structure and the Query
string I'm using.

I hope you can help,

Please let me know if u need further information,

Your help is greatly Appreciated.

Thanks in advance
g
Cristian Garofalo



INSERT INTO T_NOTICIAS ( not_id , not_cod , not_nombre , not_detalle ,
not_fecha_publicacion , not_archivo_c_name , not_archivo_c_type ,
not_archivo_c_size , not_archivo_c_content , not_archivo_r_name ,
not_archivo_r_type , not_archivo_r_size , not_archivo_r_content )
VALUES (NULL , '', 'Cris', '', , 'noticia.pdf', 'application/pdf',
'15581','$content', NULL , NULL , NULL ,'')


if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0)
{
$fileName = $_FILES['userfile']['name'];
$tmpName = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];

$fp = fopen($tmpName, 'r');
$content = fread($fp, filesize($tmpName));
$content = addslashes($content);
fclose($fp);

if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
}

$query = la que les pase

mysql_query($query, $connection_string) or die(mysql_error());

}



CREATE TABLE `T_NOTICIAS` (
`not_id` int(100) NOT NULL auto_increment,
`not_cod` varchar(5) NOT NULL default '///',
`not_nombre` varchar(30) NOT NULL default '',
`not_detalle` varchar(100) default NULL,
`not_fecha_publicacion` varchar(10) default NULL,
`not_archivo_c_name` varchar(30) default NULL,
`not_archivo_c_type` varchar(30) default NULL,
`not_archivo_c_size` int(11) default NULL,
`not_archivo_c_content` blob,
`not_archivo_r_name` varchar(30) default NULL,
`not_archivo_r_type` varchar(30) default NULL,
`not_archivo_r_size` int(11) default NULL,
`not_archivo_r_content` blob,
UNIQUE KEY `not_id` (`not_id`),
UNIQUE KEY `not_id_4` (`not_id`),
KEY `not_id_2` (`not_id`),
KEY `not_id_3` (`not_id`)
) TYPE=MyISAM AUTO_INCREMENT=2 ;

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация