简体   繁体   中英

What is the equivalent of this mysql_result() in terms of mysqli_result()

$query = "SELECT `uid` FROM `userdata` WHERE `username` = '$username' AND `password` = '$password'";
$query_run = mysqli_query($con, $query);

Note :- $con = mysqli_connect($host, $user, $pword);

$query_num_rows = mysqli_num_rows($query_run);
$user_id = mysql_result($query_run,0,'uid');//How do convert this line to mysqli_result() function???

The answer is :- replace the line

$user_id = mysql_result($query_run,0,'uid');

with

$row = mysqli_fetch_assoc($query_run);
            echo $row['uid'];                             

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM