I have a function call that is loaded from an include file. The function is coming up with the variable value before it returns. But it isn't passing the variable back to the rest of my code.
Here is code:
<?php
require_once("includes/member_fns.php");
// Do some functions to write the top of the HTML page
db_connect ()
or exit (); // This is working fine
//The next function [row_count()] is called indirectly from my include file
// member_fns.php required once above has a line in it to
// call db_fns.php which is where this function resides
// it is called with: "require_once("includes/db_fns.php");"
row_count();
//The variable $row_count comes out blank in the rest of this script!!
print ("Returned value of row_count = $row_count. <br>");
print ("<p>OMGMA currently has " . $row_count .
" members.</p>");
?>
// Here is the function called from db_fns.php
function row_count()
{
$result_id = mysql_query ("SELECT COUNT(*) FROM directory")
or exit ();
if ($row = mysql_fetch_row ($result_id))
$row_count = $row[0];
mysql_free_result ($result_id);
print ("Result of row_count = $row_count. <br>"); //This line works!
return ($row_count); // This line is not retuning the value!!
}
Any thoughts on why it would pick up the right value in the function but not return it to the rest of the script?
Thanks