What is causing this is a single quote in the string you're trying to insert.

You should use:

  $yourString = mysql_real_escape_string ( $yourString );

before you try to insert it.

Also it looks like you have named your table 'view' and I suggest you don't do this, in the new version of mySQL 'view' will be a reserved word (and views will be supported). This is not causing your problem but you do want to choose another name for your table.

Good Luck,

On Sep 19, 2005, at 11:25 AM, [EMAIL PROTECTED] wrote:

From: Yui Hiroaki <[EMAIL PROTECTED]>
Date: September 19, 2005 11:25:35 AM PDT
To: php-db@lists.php.net
Subject: insert error for mysql


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",
$strbuf = fread($handle, 2048000);
echo $strbuf;


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

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

Please do help me!


Reply via email to