How can I effectively replace the old mysql_result? I've read the documentation but it seems I need to change a lot in the old code to make it work again with mysqli_*. Can someone clarify to me what should be done? And explain what is actually different? Your help will be appreciated!
Example 1
function time() {
global $db;
$sql = "select time from table where id='$id'";
$result = mysqli_query($db, $sql);
return mysql_result($result, 0);
}
Example 2
function history() {
global $db;
$sqlbc = "select count(DISTINCT user_id) from history and time>=DATE_SUB(CURDATE(),INTERVAL 10 MINUTE);";
$rbc = mysqli_query($db, $sqlbc);
$ten = mysql_result($rbc, 0, 0);
mysqli_free_result($rbc);
}
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.
Effectively replace the old mysql_result without drastic changes.
in PHP Coding Help
Posted · Edited by samet5
How can I effectively replace the old mysql_result? I've read the documentation but it seems I need to change a lot in the old code to make it work again with mysqli_*. Can someone clarify to me what should be done? And explain what is actually different? Your help will be appreciated!
Example 1
function time() { global $db; $sql = "select time from table where id='$id'"; $result = mysqli_query($db, $sql); return mysql_result($result, 0); }
Example 2
function history() { global $db; $sqlbc = "select count(DISTINCT user_id) from history and time>=DATE_SUB(CURDATE(),INTERVAL 10 MINUTE);"; $rbc = mysqli_query($db, $sqlbc); $ten = mysql_result($rbc, 0, 0); mysqli_free_result($rbc); }