Home >Backend Development >PHP Tutorial >问sql查询的有关问题,与昨天相同请jordan102进来一下

问sql查询的有关问题,与昨天相同请jordan102进来一下

WBOY
WBOYOriginal
2016-06-13 10:07:321081browse

问sql查询的问题,与昨天相同请jordan102进来一下!
我用select * from user_list where user_id in (883985,883987,802928,802929);
查询结果只有一行返回值,不是四行,请教你有没有在php环境下用这个sql语句做过测试,谢谢

命令行下的查询结果
=============================================================
| 802928 | fnms | fnms | NULL | 非你莫属 |
| 802929 | xwei | xwei | NULL | 校尉 |
| 883985 | gggef | gggef | NULL | gggef |
| 883987 | eeett | eeett | NULL | eeett |


在php页面中

$newsql = "select * from user_list where user_id in (883985,883987,802928,802929)";
$rsList= mysqli_query($conn,$newsql)
while($row = mysqli_fetch_array($rsList))
{
echo "
-------------user_id:".$row["user_id"];
}
以下是打印结果
==========================================================================================
-------------user_id:802928

------解决方案--------------------
首先把sql语句在命令行下或phpmyadmin下执行一下,看结果对不对。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn