Hello
Do you known how how to write a prepared request (php, mysql) With omeka C ?
I’d like to use mysqli ![:slight_smile: :slight_smile:](https://forum.omeka.org/images/emoji/twitter/slight_smile.png?v=12)
if ($stmt = $mysqli->prepare(“SELECT District FROM City WHERE Name=?”)) {
etc…
How formulate this part of code ?
Many thanks
Olivier
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’);
$stmt->execute();
$rows = $stmt->fetchAll();
is it the right way ?
Thanks for your help
Olivier