Home  >  Article  >  Backend Development  >  php查询mysql表字段输出,该如何解决

php查询mysql表字段输出,该如何解决

WBOY
WBOYOriginal
2016-06-13 10:29:33959browse

php查询mysql表字段输出

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?php $connect = mysql_connect('127.0.0.1', 'root', '123456');mysql_select_db('name', $connect);$sql = "select tel from user";$query = mysql_query($sql);$dtp = new DedeTemplate();$dtp->Assign('carts',$carts);$dtp->LoadTemplate(_PLUS_TPL_.'/user.htm');$dtp->Display();exit;?> 


在user.htm应该如何调用查询到tel字段的内容?

------解决方案--------------------
$query = mysql_query($sql);

while ($re=mysql_fetch_assoc($query)){
print_r($re);
}


------解决方案--------------------
用的什么模板引擎。你没有把“tel字段的内容”Assign 到模板去。
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