Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/249.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 给定的名称和日期不显示任何数据_Php_Mysql_Mysqli - Fatal编程技术网

Php 给定的名称和日期不显示任何数据

Php 给定的名称和日期不显示任何数据,php,mysql,mysqli,Php,Mysql,Mysqli,这是我的桌子 现在我想根据名称(Test)和月份(01)将数据从MySQL检索到android,但没有数据显示。我的php有什么错误吗 我的php代码 <?php define('HOST','127.0.0.1:3307'); define('USER','root'); define('PASS',''); define('DB','androiddb'); $con = mysqli_connect(HOST,USER,PASS,DB) or die('una

这是我的桌子

现在我想根据名称(Test)和月份(01)将数据从MySQL检索到android,但没有数据显示。我的php有什么错误吗

我的php代码

<?php
  define('HOST','127.0.0.1:3307');
  define('USER','root');
  define('PASS','');
  define('DB','androiddb');

  $con = mysqli_connect(HOST,USER,PASS,DB) or die('unable to connect');

  $name = $_GET['name'];

  $month = $_GET['month'];

 $sql = "select * from information WHERE name= '". $name."' and month = '".$month."'";

  $res = mysqli_query($con,$sql);

  $result=array();

  while($row=mysqli_fetch_array($res)){
      array_push($result,array('id'=>$row[0],'name'=>$row[1],'weather'=>$row[2],'date'=>$row[3],'status'=>$row[4],
      'time_in'=>$row[5], 'time_out'=>$row[6]));
  }

 echo (json_encode(array("result"=>$result)));

mysqli_close($con);

?>

在SQL语句中有一个条件
month=…
,但表中没有month列

这应该起作用:

$sql = "select * from information WHERE name= '". $name."' and MONTH(date) = '".$month."'";