@@ -329,7 +329,7 @@ public function insert($tableName, $insertData)
329329 if ($ this ->isSubQuery )
330330 return ;
331331
332- $ this ->_query = "INSERT into " .self ::$ _prefix . $ tableName ;
332+ $ this ->_query = "INSERT INTO " .self ::$ _prefix . $ tableName ;
333333 $ stmt = $ this ->_buildQuery (null , $ insertData );
334334 $ stmt ->execute ();
335335 $ this ->_stmtError = $ stmt ->error ;
@@ -721,8 +721,8 @@ protected function _buildTableData ($tableData) {
721721 $ isUpdate = strpos ($ this ->_query , 'UPDATE ' );
722722
723723 if ($ isInsert !== false ) {
724- $ this ->_query .= '(` ' . implode (array_keys ($ tableData ), '`, ` ' ) . '`) ' ;
725- $ this ->_query .= ' VALUES( ' ;
724+ $ this ->_query .= ' (` ' . implode (array_keys ($ tableData ), '`, ` ' ) . '`) ' ;
725+ $ this ->_query .= ' VALUES ( ' ;
726726 } else
727727 $ this ->_query .= " SET " ;
728728
@@ -778,7 +778,7 @@ protected function _buildWhere () {
778778 return ;
779779
780780 //Prepair the where portion of the query
781- $ this ->_query .= ' WHERE ' ;
781+ $ this ->_query .= ' WHERE ' ;
782782
783783 // Remove first AND/OR concatenator
784784 $ this ->_where [0 ][0 ] = '' ;
@@ -937,7 +937,9 @@ protected function replacePlaceHolders ($str, $vals) {
937937 $ val = $ vals [$ i ++];
938938 if (is_object ($ val ))
939939 $ val = '[object] ' ;
940- $ newStr .= substr ($ str , 0 , $ pos ) . $ val ;
940+ if ($ val == NULL )
941+ $ val = 'NULL ' ;
942+ $ newStr .= substr ($ str , 0 , $ pos ) . "' " . $ val . "' " ;
941943 $ str = substr ($ str , $ pos + 1 );
942944 }
943945 $ newStr .= $ str ;
0 commit comments