
June 14th, 2003, 02:52 PM
|
|
Junior Member
|
|
Join Date: Jun 2003
Location: Sarnia, Ontario
Posts: 4
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Functions and arrays - ARRG!!
Ok here is the problem. I am doing a var_dump at the end to make sure I have the correct values in the array; which I do... I get this: array(2) { [0]=> string(3) "232" [1]=> string(3) "132" }
So I should be able to do a return statment and this values should be brough back, right? Wrong. I do another var_dump in the script that requested the function after the function is excuted and I get the same values. Now how do I get the data out of that array?
This is the main file
PHP Code:
<?php
//If there is no menuID then exit; you can't do anything without it
if($menuID == '' || $menuID == NULL){
echo "Error 001, please contact support";
exit;
}
$header_message = "Welcome, you are logged in as Administrator";
// Includes
include_once("config.php");
include_once("css.php");
FMENU_DRAW($menuID, $header_message);
switch($menuID){
case 0:
include("default.php");
break;
default:
echo "There was a problem";
}
?>
This is the function:
PHP Code:
function QUICK_STATS_QUERY(){
global $link;
$query1 = "SELECT count(user_expirydate) FROM users WHERE user_expirydate >= curdate()";
$query2 = "SELECT count(user_expirydate) FROM users WHERE user_expirydate < curdate()";
for($i=0; $i <= 1; $i++){
$query_array = array($query1, $query2);
$QUERY_quickstats = $query_array[$i];
$infoquery_results = mysql_query($QUERY_quickstats, $link) or die("MySQL query infoquery failed. Error if any: ".mysql_error());
$infoquery_results = mysql_fetch_array($infoquery_results);
$active_details[$i] = $infoquery_results["count(user_expirydate)"];
}
var_dump($active_details);
return array (0);
}
|