a from query, using the associative array (fetch-assoc), I assigning each value to variable which I then wish to create a div class named by that variable i.e. div class=”$variable”. I having issues regarding the escape characters as far I understand, I could be wrong as well as I’m pretty new to PHP
code snippet as follows:
[code]
$titlecategorysubcategory = $connect->query(“SELECT SubCategoryTitle, SubCategoryDescription_LrgDesc FROM lkuTbl_SubCategory INNER JOIN lkuTbl_Category ON FK_CategoryId = PK_CategoryId WHERE CategoryTitle = ‘$category_title’ “);
while($cattitlesubcategorytitle = $titlecategorysubcategory->fetch_assoc()) {
$subcategorytitledescript[$cattitlesubcategorytitle[‘SubCategoryTitle’]] = $cattitlesubcategorytitle[‘SubCategoryDescription_LrgDesc’];
}
foreach($subcategorytitledescript as $ky => $val) {
$subcategory_title = $ky; < fine up to here assigning variable
/*
but from here I wish to something such as either
?>
<div class=”$subcategory_title”></div>
</php
OR
echo ‘<div class=”‘ . $subcategory_title . ‘”></div>’;
*/
}
Having referred to
I’ve used the both as guided by 3.2 and 3.3
so
[code]echo “<div class=”$subcategory_title”>Hello world</div>”;
and
[code]echo ‘<div class=”‘ . $subcategory_title . ‘”></div>’;
but both show PHP Parse error: syntax error, unexpected ‘<‘ in /home/mnzsm9leak30/public_html/menu1.php
can someone possibly guide me or provide me with solution
Many thanks in advance much appreciated