Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/281.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/14.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
var_转储数组(0){}php_Php_Arrays_Var Dump - Fatal编程技术网

var_转储数组(0){}php

var_转储数组(0){}php,php,arrays,var-dump,Php,Arrays,Var Dump,正在尝试查看此数组中是否存在实际数据: 以下是我正在运行的查询: global $wpdb; $gather_answers = "SELECT * FROM ".$wpdb->prefix."comments WHERE comment_post_ID = '" . $comment_parent_id . "' ORDER BY comment_date"; $user_answers = $wpdb->get_results($gather_answers);

正在尝试查看此数组中是否存在实际数据: 以下是我正在运行的查询:

 global $wpdb;
    $gather_answers = "SELECT * FROM ".$wpdb->prefix."comments WHERE comment_post_ID = '" . $comment_parent_id . "' ORDER BY comment_date";
    $user_answers = $wpdb->get_results($gather_answers);

    var_dump($user_answers);
当我对数组进行var_转储时,输出为:

array(0) { }
我尝试访问它的某些部分,如:

var_dump($user_answers[0]);
但是什么也没发生

你知道这个数组中是否有数据吗

var_dump($user_answers); 
一无所获? 数组中没有数据

数组和对象通过递归方式进行探索,因此,如果存在任何数据,它就会显示出来

一无所获? 数组中没有数据


数组和对象由递归搜索,因此如果存在任何数据,它将显示出来。

您的查询可能不会返回任何内容,即您请求的帖子可能没有任何注释。如果您确定存在注释,则查询可能会失败,因为您在查询中将注释\u post\u id视为字符串,而不是整数。尝试按如下方式重新格式化:

$gather_answers = $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d ORDER BY comment_date", $comment_parent_id );

您的查询可能不会返回任何内容,即您请求的帖子可能没有任何评论。如果您确定存在注释,则查询可能会失败,因为您在查询中将注释\u post\u id视为字符串,而不是整数。尝试按如下方式重新格式化:

$gather_answers = $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d ORDER BY comment_date", $comment_parent_id );

array0表示数组有0个索引空正在尝试学习,为什么要记下要学习的人…以检查数组使用中是否有数据。array0表示数组有0个索引空正在尝试学习,为什么要记下要学习的人…以检查数组使用中是否有数据。