Mysqli_query result to variable PHP [duplicate]

2019-08-12 02:48发布

This question already has an answer here:

I've tried looking around and couldn't find an answer myself, so I'll post my problem instead, maybe it will help other people :)

I'm making a mysql query and getting an array out of it as it's supposed to do, but I want to take my first result out of this array and put that result in a variable instead so I can use it in my logic.

$conn = new mysqli($servername, $username, $password, $dbname);
$value_High = mysqli_query($conn, "SELECT MAX(picID) from pictures");
$id = mysqli_data_seek($value_High, 0);
var_dump($id);

I've tried some different things, I get a bool out of myqli_data_seek which is not what I want ofc, so I obviously need to use something else, I just don't know what.

标签: php mysql mysqli
1条回答
手持菜刀,她持情操
2楼-- · 2019-08-12 03:19
$id = mysqli_fetch_row($value_High);
查看更多
登录 后发表回答