Home > Backend Development > PHP Tutorial > php+mysql 面向对象 容易查询表的信息

php+mysql 面向对象 容易查询表的信息

WBOY
Release: 2016-06-13 12:11:41
Original
981 people have browsed it

php+mysql 面向对象 简单查询表的信息
本人新手自学中~求简单易懂的代码。
如果你不忙,帮我看看这段我写的代码,

网页空白,写到最后 我感觉我还是在面向过程,怎么回事~~~
求指点~~
------解决思路----------------------
其实当你不会写代码的时候,可以参考下别人写代码的思想,之后转化为自己的东西,学以致用。
http://www.oschina.net/code/snippet_96541_3441
------解决思路----------------------
你的select方法没有使用mysql_fetch_assoc或者mysql_fetch_array获取数据,所以出不来结果。
应该这样

<br />$result = mysql_query("SELECT * FROM users");<br />$rows = array()<br />while ($row = mysql_fetch_assoc($result)) {<br />        $rows[] = $row;<br />    }<br />print_r($rows);<br />
Copy after login

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template