#1 RX pharmacy affiliate program!

Multiple PDO binding

29 12 2007

Недавно упёрся вот такой косяк:

You cannot bind multiple values to a single parameter; for example, you cannot bind two values to a single named parameter in an IN() clause.

Кто понимает - знает о чём я. И нашёл в инете элегантное решение проблемы:

<?php
$inList = array();
$params = array();
$i = 0;

foreach ($user_ids as $userId) {
$inList[] = ‘:del’ . $i;
$params[':del' . $i] = $userId;
}

$st =$db->prepare(’delete from user_tbl where user_id in (’ . implode(’,', $inList) . ‘)’);
$st->execute($params);
?>

Может кому пригодится :) Мне не помогло, я кол - во параметров заранее не знаю. Решил проблему иначе (против лома нет приёма).

Google Bookmarks Digg Reddit del.icio.us Technorati News2.ru БобрДобр.ru RUmarkz Ваау! Memori.ru

Informations

Leave a comment

*
To prove that you're not a bot, enter this code
Anti-Spam Image

You can use these tags : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>