我的查询不回数据

时间:2018-05-31 08:55:12

标签: php mysql

我写这个查询,它在phpmyadmin

中工作

$query_string = "SELECT * FROM positions WHERE place_id IN (SELECT ID FROM place WHERE Title='آرایشگاه')"; $res = mysqli_query($conn, "$query_string"); mysqli_set_charset($conn, 'utf8'); $myArray = array(); if ($res->num_rows > 0) { for ($i = 0; $i < $res->num_rows; $i++) { $myArray[$i] = $res->fetch_assoc(); } } var_dump($myArray);

但是当我在我的文本编辑器中使用它时什么都没有

&#13;
&#13;
//i == 3
if(self.deletingId == DataMixin.data.holidayList[i+1].reason){
        //code
}
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:-1)

您可以尝试解决问题。

 $query_string = "SELECT * FROM positions WHERE place_id IN (SELECT ID 
 FROM place WHERE Title='آرایشگاه')";
 $res = mysqli_query($conn, $query_string);
 mysqli_set_charset($conn, 'utf8');
 $result = $res->fetch_assoc();
 $myArray = array();
 if ($res->num_rows > 0) {
  for ($i = 0; $i < $result->num_rows; $i++) {
    $myArray[$i] = $result[$i]['id'];
    $myArray[$i] = $result[$i]['password'];
    $myArray[$i] = $result[$i]['name'];
  }
 }


 var_dump($myArray);