db_placeholders

Definition

db_placeholders($arguments, $type = 'int')
includes/database.inc, line 232

Description

Generate placeholders for an array of query arguments of a single type.

Given a Schema API field type, return correct %-placeholders to embed in a query

Parameters

$arguments An array with at least one element.

$type The Schema API type of a field (e.g. 'int', 'text', or 'varchar').

Related topics

Namesort iconDescription
Database abstraction layerAllow the use of different database servers using the same code base.

Code

<?php
function db_placeholders($arguments, $type = 'int') {
  $placeholder = db_type_placeholder($type);
  return implode(',', array_fill(0, count($arguments), $placeholder));
}
?>
 
 

Drupal is a registered trademark of Dries Buytaert.