Home > Backend Development > PHP Tutorial > 求PHP获取数据表字段值的完整代码解决方法

求PHP获取数据表字段值的完整代码解决方法

WBOY
Release: 2016-06-13 13:16:38
Original
716 people have browsed it

求PHP获取数据表字段值的完整代码
数据表php_area

字段areaid,name 


获取areaid=2,name的值

麻烦知道的大哥给完整的代码,谢谢了


------解决方案--------------------

PHP code
mysql_connect("localhost",'用户名','密码');
mysql_select_db('库名');
$r=mysql_query("select name from php_area where areaid=2");
$row=mysql_fetch_row($r);   //如果areaid 不唯一,此处加上while循环
echo $row[0]; <div class="clear">
                 
              
              
        
            </div>
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