| 
 | 
  Imagine Programming - 2011-06-23 14:11:31  
When you just explode on semicolons, you might potentially split the content of the actual query as well. e.g. 
 
$sql = "INSERT INTO `forum-posts` (title,message,date) VALUES ('hello world', 'my message; some, nice, list, here.', $date);" 
$sql.= "INSERT INTO `forum-log` (date,event) VALUES ($date, 'FORUM_POST_ADD');"; 
 
 
How will this affect the end result? 
  
  Richard Buskirk - 2011-06-28 11:42:29 -  In reply to message 1 from Imagine Programming 
$sql = "INSERT INTO `forum-posts` (title,message,date) VALUES ('hello world', 'my message; some, nice, list, here.', $date);" 
 
I understand the thought behind the query above but the final syntax is invalid. Why do you have a semicolon before the end double quotes? This query would not run in any instance much less this class. 
 
 
$sql.= "INSERT INTO `forum-log` (date,event) VALUES($date, 'FORUM_POST_ADD');"; 
 
The only issue with this is your syntax is invlaid. Why would anyone put a semicolon before the double quote? There is no justification for the first semincolon. 
 
 
  
  Richard Buskirk - 2011-06-28 11:53:51 -  In reply to message 2 from Richard Buskirk 
I am going to retract the comment. I guess I just dont understand the whole concept of exploding, when this should be an array. 
 
$sql .= "INSERT INTO `table` (`name`) VALUES ('name 1');"; 
 
Should be 
 
$sql[] = "INSERT INTO `table` (`name`) VALUES ('name 1');"; 
 
This of course means the class will have to be adjusted to accept an array. 
 
 
  
  Imagine Programming - 2011-06-28 16:15:27 -  In reply to message 3 from Richard Buskirk 
That is the unfortunate part of explode();, it literally finds any character and splits it right there.  
 
An array would be a nice way too though, I wouldn't mind. 
 
$db->setSQL(array( 
  "query1...", 
  "query2..." 
)); 
 
This aside, isn't it possible to use PDO for executing large blocks 
of SQL at once? 
  
  Gilton Guma - 2011-08-14 01:49:30 -  In reply to message 1 from Imagine Programming 
Imagine Programming, 
I have not tested the way posted, but decided to adjust the class to avoid future problems.  
 
Thanks for the comment, was a great help! :)  
 
Sorry my English! 
  
  Gilton Guma - 2011-08-14 01:57:26 -  In reply to message 3 from Richard Buskirk 
Richard Buskirk, 
I followed your suggestion and updated the class to accept array instead of using the "explode". 
 
Thanks for the comment, was a great help! :)  
 
Sorry my English! 
  
  Gilton Guma - 2011-08-14 02:06:20 -  In reply to message 4 from Imagine Programming 
PDO is available only as of version 5.1 (without auxiliary scripts), while this class can be used for 5.0+. 
  
   |