You actually already have the code. It is doquery(). Here is the section of code that the error occured:
$loc = strpos( $val, ';' );
if ( $loc > 0 && strlen(trim($val)) > 1 )
{
$val[strlen($val) - 1] = ' ';
str_replace( ';', ' ', $val );
$DB_site->query($val);
if ($onvservers==1 and substr($val, 0, 5)=="ALTER")
{
$DB_site->link_id=0;
@mysql_close();
sleep(1);
$DB_site->connect();
}
}
I get the error on the $DB_site->query($val); line.
I have a function that takes a file name and reads the contents of the file. The contents of the file is an SQL statement which can be on either one line or multiple lines but has to end with a ; . The last time I got the error it was executing the following SQL
CREATE TABLE IF NOT EXISTS `viPortfolio` (
`viPortfolioid` smallint(6) unsigned NOT NULL auto_increment,
`userid` int(10) unsigned NOT NULL default '0',
`mimeid` mediumint unsigned NOT NULL default '1',
`filename` VARCHAR(250) NOT NULL,
`file` BLOB NOT NULL,
`thumb` BLOB NOT NULL,
`width` int(10) unsigned NOT NULL default '0',
`height` int(10) unsigned NOT NULL default '0',
`text` mediumtext NOT NULL,
`startdate` date NOT NULL,
`enddate` date,
`updateid` MEDIUMINT,
`viewcount` MEDIUMINT default '0',
PRIMARY KEY `userid` (`viPortfolioid`, `userid`, `mimeid`)
) TYPE=MyISAM;
Iinitialy I had place this line before the query statement:
$val[strlen($val) - 1] = ' ';
I must have had a space at the end of the line or something because the ; got past it. Then I replaced that line with the line below.
str_replace( ';', ' ', $val );
Yes, this does fix the problem. It takes the ; out of the statement so that MySql doesn't have to deal with it. I still would like to know why it cares. A ; has always been a statement ender in any DB system I have used before?
|