
正文
php获得表中数据 php获取excel单元格数据
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
php怎么获取数据表中内容
?php
//打印出来的是对象object直接调用属性即可
$name = $diy-info-name;
如有疑问,请追加
相关问答
Q1: PHP怎么获取表单中的多条数据
在生成的表单元素以及之前的元素的名字加上中括号即可实现
比如: name="contents" = name="contents[]",最后提交获取到的数据是一个数组形式的。
代码如下:
form name="form1" method="post" action="index.php?action=ok"
1.input type="text" name="contents[]" value=""
2.input type="text" name="contents[]" value=""
3.input type="text" name="contents[]" value=""
input type="submit" value="提交"
/form
?php
if($_GET['action'] == 'ok'){
$contents = $_POST['contents'];
print_r($contents);
}
?
得到的数据是数组形式的,遍历即可。
Q2: php获取表中所有查询出来的结果数据
通过for循环
$sql=mysql_query("select * from 表名 where name=张三“)
for($i=0;$imysql_num_rows($sql);$i++){
$result[$i] = mysql_fetch_assoc($sql);
}
临时写的,比较匆忙。可以自己看看。
mysql_num_rows是获取一同有多少条数据
mysql_fetch_assoc和mysql_fetch_array差不多,自己查







