Resquest prepared on Omeka C


Do you known how how to write a prepared request (php, mysql) With omeka C ?
I’d like to use mysqli :slight_smile:

if ($stmt = $mysqli->prepare(“SELECT District FROM City WHERE Name=?”)) {

  • $stmt->bind_param(“s”, $city);*

  • $stmt->execute();*


How formulate this part of code ?

Many thanks


Normally database query stuff in Omeka Classic is written using Zend_Db, which itself uses mysqli and prepared statements. It’s possible to get at the underlying mysqli connection object if you want to use mysqli directly, too.

Many thanks !

I try :

$db = get_db();
$stmt = $db->prepare(‘SELECT * FROM myTable WHERE id = :placeholder’);
$stmt->bindValue(‘placeholder’, ‘26’);

$rows = $stmt->fetchAll();

is it the right way ?

Thanks for your help