我有两个表,从这个代码我从两个表中获取值但是一个表值我得到 $ data [] = $ row; (我在这里得到了值)但是还有一个表价值我无法得到... $ fstname = $ r ['emp_firstname']; (没有获得ans).fstname值它应该返回null。
<?php
session_start();
include('dbconfig.php');
if(empty($_SESSION['email'])){
header('Location:login.php');
}
$status = $_POST['status'];
$sql = mysql_query("SELECT * FROM task WHERE t_delete_on='0' AND t_status='$status'");
$count=mysql_num_rows($sql);
$return = array();
if($count > 0){
while($row=mysql_fetch_assoc($sql)){
$data[]=$row;
}
$return=array('status'=>'success','count'=>$count,'data'=>$data);
echo json_encode($return);
}else{
$sql = mysql_query("SELECT * FROM task WHERE t_delete_on='0' AND t_status!='3'");
$count=mysql_num_rows($sql);
if($count > 0){
while($row=mysql_fetch_assoc($sql)){
$data[]=$row;
}
$return=array('status'=>'bending','count'=>$count,'data'=>$data);
echo json_encode($return);
}
}
?>