So here's the code:
function procRestSearch($searchQuery){
//Don't forget to have $searchquery defined before calling this function
$intSearchCounter = 0; //Used to set the arrays
$searchResult = mysql_query($searchQuery);
while($searchRow = mysql_fetch_array($searchResult, MYSQL_ASSOC)){
//Change/Add/Delete the variables below to match what data needs to be returned
$strRest = array($intSearchCounter => array('restID' => $searchRow['rest_id'],
'restName' => $searchRow['rest_name'], 'restAddress' => $searchRow['rest_address'],
'restAddress2' => $searchRow['rest_address2'], 'restCity' => $searchRow['rest_city'],
'restState' => $searchRow['rest_state'], 'restZip' => $searchRow['rest_zip'],
'restCC' => $searchRow['rest_country_code'], 'restAC' => $searchRow['rest_area_code'],
'restPhone' => $searchRow['rest_phone_no'], 'restFAC' => $searchRow['rest_fax_no'],
'restManager' => $searchRow['rest_manager'], 'restAsManager' => $searchRow['rest_assistant_manager'],
'restWebsite' => $searchRow['rest_website']));
$intSearchCounter++;
}
return $strRest;
}
the problem is when I call this function I get a Notice: Undefined offset: 0 in... error. However, if I replace $intSearchCounter with a static value, such as just replacing it with 0, it works but then I only get the last result from the query returned. What am I doing wrong?