Hello
Do you known how how to write a prepared request (php, mysql) With omeka C ? I’d like to use mysqli
if ($stmt = $mysqli->prepare(“SELECT District FROM City WHERE Name=?”)) {
$stmt->bind_param(“s”, $city);*
$stmt->execute();*
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
This topic was automatically closed 360 days after the last reply. New replies are no longer allowed.