12-02-2007, 10:47 PM
|
#3 (permalink)
|
|
The Acquainted
Join Date: Oct 2007
Posts: 170
Thanks: 18
|
You make it an associative array, so you don't need to have any numbers involved. Instead, you're using the name of the result (numrows). Hope that makes any sense!
Let me clearify with an example..
First we try it with a numeric array:
PHP Code:
$pResult = mysql_query("SELECT COUNT(*) AS NumberOfResults FROM MEMBERS WHERE interest = '$inte' AND age < $age") or mysql_error();
$aRow = mysql_fetch_array($pResult, MYSQL_NUM);
$iNumber = $aRow[0];
echo $iNumber;
// Would echo 2 in this case
Now make it an associative array:
PHP Code:
$pResult = mysql_query("SELECT COUNT(*) AS NumberOfResults FROM MEMBERS WHERE interest = '$inte' AND age < $age") or mysql_error();
$aRow = mysql_fetch_array($pResult, MYSQL_ASSOC);
$iNumber = $aRow['NumberOfResults'];
echo $iNumber;
// Would also echo out 2
Hope this helps you out :)
|
|
|
|