Jump to content

select where bug 4.2.0


Recommended Posts

require_once './init.php';

$where = array (
	'pid IN(57,58)',
$select = \IPS\Db::i()->select( 'COUNT(*) as cnt', 'core_polls', $where );

it print:

D:\Programmi\Ampps\www\ips4\test.php:10:string 'SELECT COUNT(*) as cnt FROM `core_polls` WHERE pid IN(57,58)' (length=60)

where is poll_closed go?

Can anyone test this for 4.2.2 or lastest? @bfarber



Link to comment
Share on other sites

Your where is structured incorrectly, the second index of the array is used for binds (prepared statements), not another where clause.

See the comments on \IPS\Db::compileWhereClause():

	 * Compile WHERE clause
	 * @code
	 	// Single clause
	 	"foo IS NOT NULL"
	 	// Single clause with bound values (always bind values to ensure they are properly escaped)
	 	array( 'foo=?', 'fooValue' )
	 	array( 'foo=? OR bar=?', 'fooValue', 'barValue' )
	 	// Multiple clauses (will be joined with AND) with bound values
	 	array( array( 'foo=?, 'fooValue' ), array( 'bar=?', 'barValue' ) )


Link to comment
Share on other sites

Thanks for all, I have missed compileWhereClause instructions, therefore I have changed:

			\IPS\advpolls\Poll::$databasePrefix . \IPS\advpolls\Poll::$databaseColumnMap['container'],
					\IPS\advpolls\Category::$databasePrefix . \IPS\advpolls\Category::$databaseColumnId,

into \IPS\advpolls\Table constructor :thumbsup: (temporary fix, avoiding uncategorized polls)

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...