我感到非常沮丧-由于某种原因,我的函数未返回任何内容。使用我的所有其他功能,它们可以正常工作。我来回传递数组,没问题。
function get_location_data ($info,$wpdb)
{
//Status Reports Not Working- but page not broken so Fix this.
//Location Records
//This is more complex b/c of the way that the DB is done.
$data_passed = explode("++", $info["location_station_ID"]);
//var_dump ($info);
//echo "<br>";
//var_dump ($data_passed);
$location_key = trim($data_passed[0]);
$location_name = $data_passed [1];
//var_dump ($location_key);
//echo '<br>';
//Query the DB and get all the location reports for the location
$sql = "SELECT report_key, ship_deployment_line_key FROM stations_deployed_rows WHERE station_key = '" . $location_key . "'";
$reports_in_db = $wpdb->get_results($sql);
$qry = $wpdb->last_query;
//var_dump ($qry);
//var_dump ($reports_in_db);
if (empty($reports_in_db))
{
echo "No Records for location " . $location_name . "\n";
$total_report = "None";
}
else
{
$total_report = array();
$loop_c = 0;
foreach($reports_in_db as $key)
{
++$loop_c;
$total_report [$loop_c] = $key;
}
//var_dump ($total_report);
$tables_to_sort = sort_rows_into_tables ($total_report,"ship_deployment_line_key", $wpdb);
print_report_types ($tables_to_sort);
}
return $total_report;
}
基本上我想做的-从此函数中删除打印调用,而是返回要打印的行数组。
$data_passed = explode("++", $_POST ["location_station_ID"]);
$tables = get_location_data ($data_passed,$wpdb);
var_dump ($tables);
这是函数被调用的地方。
但是:当我var_dump $tables
时-没有任何显示。该函数与被调用的文件位于不同的文件中(尽管这不应该成为问题-函数文件中的许多函数返回值)
关于发生的事情有什么想法吗?