Mysql
 sql >> Datenbank >  >> RDS >> Mysql

Konvertieren Sie mysql in mysqli?

<?php
 $db = new mysqli('localhost','root', '', 'searchengine');

    if($db->connect_errno) {
        die('sorry we are having some problbems');
        }

$sql = $db->query(sprintf(
    "SELECT * FROM searchengine WHERE pagecontent LIKE '%s' LIMIT 0,%d",
        '%'. $db->real_escape_string($_GET['term']) .'%',
        $db->real_escape_string($_GET['results']))
);

while($ser = $sql->fetch_array()) {
    echo "<h2><a href='" . $ser['pageurl'] . "'>" . $ser['pageurl'] . "</a></h2>";
}

$db->close();