Home >Backend Development >PHP Tutorial >请问如何用PHP查询mysql返回的值

请问如何用PHP查询mysql返回的值

WBOY
WBOYOriginal
2016-06-23 14:01:341192browse

比如我是查询的多少条 select count(*) from csdn;

在mysql里面是直接返回的多少条,比如是2039条。

那在PHP里面我怎么样把这个结果显示到页面来

我用mysql_fetch_row 返回来的是一个数组,应该用哪个函数来实现呢。


回复讨论(解决方案)

$rs = mysql_query('select count(*) from csdn');$row = mysql_fetch_row($rs);echo $row[0];

$rs = mysql_query('select count(*) from csdn');$row = mysql_fetch_row($rs);echo $row[0];


谢谢徐哥,明白了,mysql_fetch_row就是返回的是一个数组,然后取下标为0的值即可.

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