Mysqli_query结果到变量PHP [英] Mysqli_query result to variable PHP

查看:181
本文介绍了Mysqli_query结果到变量PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试环顾四周,但自己找不到答案,因此我将发布问题,也许会对其他人有所帮助:)

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 :)

我正在执行一个mysql查询并从中获取一个数组,但我想从该数组中取出我的第一个结果并将其放在变量中,以便可以在我的表中使用它逻辑.

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);

我尝试了一些不同的事情,我从myqli_data_seek中得到了一个布尔值,这不是我想要的,所以显然我需要使用其他东西,我只是不知道什么.

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.

推荐答案

$id = mysqli_fetch_row($value_High);

这篇关于Mysqli_query结果到变量PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆