Having retrieved an associative array from a query, I’ve looped through and using the values, I wish to pass into a function which runs another query
I’ve done this but its constantly throwing out the error:
PHP Fatal error: Uncaught Error: Call to undefined function getDishtypeTitlesandPrice() in /home/mnzsm9leak30/public_html/test2.php:3156
Stack trace:
#0 {main}
thrown in /home/mnzsm9leak30/public_html/test2.php on line 3156
[code]
if($arrky == ‘subcategory_title’) {
$subcategorytitle_title = $arrval;
getDishtypeTitlesandPrice($subcategorytitle_title);
?>
<div class=”<?php echo strtolower(str_replace(‘ ‘, ”, $subcategorytitle_title)); ?>”>
<div class=”<?php echo strtolower(str_replace(‘ ‘, ”, $subcategorytitle_title)) . “-titledescription”; ?>”>
<div class=”<?php echo strtolower(str_replace(‘ ‘, ”, $subcategorytitle_title)) . “-title”; ?>”>
<div class=”row”>
<div class=”col-xs-12 col-sm-12 col-md-12 col-lg-12 col-xl-12″>
<h3 class=”<?php echo strtolower(str_replace(‘ ‘, ”, $subcategorytitle_title)); ?>”>
<?php echo $subcategorytitle_title; ?>
</h3>
</div>
</div>
</div>
<?php
function getDishtypeTitlesandPrice(&$str_title)
{
?>
<div class=”<?php echo strtolower(str_replace(‘ ‘, ”, $str_title)) . “-typetitle-price”; ?>”>
<?php
$subcategory_dishtypetitleprice = $connect->query(“SELECT MenuItemTitle, MenuItemType, MenuItemPrice FROM tblMenuItem LEFT JOIN lkuTbl_SubCategory ON FK_SubCategoryId = lkuTbl_SubCategory_PK_SubCategoryId WHERE lkuTbl_SubCategory_SubCategoryTitle = ‘$str_title'”);
while ($dishtypetitleprice_subcategory = $subcategory_dishtypetitleprice->fetch_assoc())
{
$traditfavourites_dishes[$dishtypetitleprice_subcategory[‘MenuItemTitle’]][] = array(
‘type’ => $dishtypetitleprice_subcategory[‘MenuItemType’],
‘price’ => $dishtypetitleprice_subcategory[‘MenuItemPrice’]
);
}
?>
</div>
<?php
}
}
yes I do know I would need to rework the div classes (<?php echo strtolower(str_replace(‘ ‘, ”, $str_title)) . “-typetitle-price”; ?>)
the error line being 3156 which is the function call itself or before ( getDishtypeTitlesandPrice($subcategorytitle_title);
)
I’ve checked scope but don’t see or understand what’s wrong, Can someone help?