php中mysqli fetch array为什么取不到记录呢?
//相关代码如下,这是其中一个代码文件<?phpsession_start();require'jpgraph/jpgraph.php';require'jpgraph/...
//相关代码如下,这是其中一个代码文件
<?php
session_start();
require 'jpgraph/jpgraph.php';
require 'jpgraph/jpgraph_line.php';
echo $_SESSION['name']."<br>";
$temp=$_SESSION['name'];
$linshitime=$_POST['time'];
echo $linshitime."<br>";
$db = mysqli_connect("localhost","root","401401","user") ;
$sql="select time from $temp where time=$linshitime";
$result=mysqli_query($db,$sql);
if($result)
echo 'result';
$row=mysqli_fetch_array($result);
echo $row[0];
?>
结果如下:但是没有echo $row[0]; 展开
<?php
session_start();
require 'jpgraph/jpgraph.php';
require 'jpgraph/jpgraph_line.php';
echo $_SESSION['name']."<br>";
$temp=$_SESSION['name'];
$linshitime=$_POST['time'];
echo $linshitime."<br>";
$db = mysqli_connect("localhost","root","401401","user") ;
$sql="select time from $temp where time=$linshitime";
$result=mysqli_query($db,$sql);
if($result)
echo 'result';
$row=mysqli_fetch_array($result);
echo $row[0];
?>
结果如下:但是没有echo $row[0]; 展开
2个回答
2015-03-17
展开全部
替换为$row=mysqli_fetch_row($result);即可取到数据。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询