One of the strings you're inserting has an quotation mark (apostrophe).
You're going to have to do some more careful data scrubbing on the
incoming data.

E.G. one of the strings says "it's used in the retail, banking, and
insurance industries, among" ...
And it's breaking the containing '   -  insert into foo (bar) values
('this isn't going to work.');

might I suggest starting with addslashes()

Cheers,
- Martin Norland, Sys Admin / Database / Web Developer, International
Outreach x3257

The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


-----Original Message-----
From: Yui Hiroaki [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 19, 2005 1:26 PM
To: php-db@lists.php.net
Subject: [PHP-DB] insert error for mysql. .

hi!

I have an error message to try to insert character into table.
But I have an error messages like below. When I try to insert
$strbuf, I got error.


Could not perform INSERT to table 1064: You have an error in your SQL
syntax. Check the manual that corresponds to your MySQL server version
for the right syntax to use near 's used in the retail, banking, and
insurance industries, among



I publish SQL;

mysql> create table view(b_col_id mediumint(255) NOT NULL
AUTO_INCREMENT, b_col longblob NOT NULL,file_name varchar(255) NOT
NULL,file_size varchar(255) NOT NULL,file_type varchar(255) NOT
NULL,file_date time,vtext longtext,PRIMARY KEY(b_col_id))TYPE=MyISAM;


mysql> alter tablev view add fulltext (vtext);

The code----------------------------------------------
$handle = popen("/usr/bin/pdftotext \"$original_tmp\" - -layout  2>&1",
'r');
$strbuf = fread($handle, 2048000);
echo $strbuf;

pclose($handle);


$sql_insert = "INSERT INTO
view(b_col,file_name,file_size,file_type,file_date,vtext) VALUES
('$binaryContent','$original_name','$original_size','$original_type',CUR
TIME(),'$strbuf')";

mysql_query($sql_insert) or DIE ("Could not perform INSERT to table
".mysql_errno().": ".mysql_error());
mysql_close($db);






Please do help me!

Yui

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to