[pLog-svn] r3154 - plog/trunk/class/dao

mark at devel.lifetype.net mark at devel.lifetype.net
Wed Mar 29 17:20:33 GMT 2006


Author: mark
Date: 2006-03-29 17:20:33 +0000 (Wed, 29 Mar 2006)
New Revision: 3154

Modified:
   plog/trunk/class/dao/articles.class.php
Log:
Fix the sql_error generated by searchCondition:

if the ids[] array is empty, the sql statements of search condition is "a.id IN ()". It will casu a sql error in mysql. Therefore I check the ids() array, if the array is empty, I set the searchCondition to "a.id = -1".

Modified: plog/trunk/class/dao/articles.class.php
===================================================================
--- plog/trunk/class/dao/articles.class.php	2006-03-29 16:54:08 UTC (rev 3153)
+++ plog/trunk/class/dao/articles.class.php	2006-03-29 17:20:33 UTC (rev 3154)
@@ -322,7 +322,10 @@
 				$ids[] = $row['article_id'];
 			}
 			
-			$searchCondition = 'a.id IN ('.implode( ', ', $ids ).')';
+			if ( !empty( $ids ) )
+				$searchCondition = 'a.id IN ('.implode( ', ', $ids ).')';
+			else
+				$searchCondition = 'a.id = -1';
 			
 			return( $searchCondition );
 		}



More information about the pLog-svn mailing list