I'm trying to read a bunch of Rows and display them without the usual "ARRAY =>" crap but all I get is this error
Notice: Undefined variable: data in C:\xampp\htdocs\sql.php on line 0
This is me code:
<?php virtual('/Connections/TDBS_local.php');
$query = "SELECT sub_category FROM sub_category WHERE main_category_id = 2 ";
$result = mysqli_query($TDBS_local, $query);
if ($result = mysqli_query($TDBS_local, $query)) {
/* fetch associative array */
if($row = mysqli_fetch_assoc($result)) {
$data = unserialize($row['sub_category']);
}
/* free result set */
mysqli_free_result($result);
}
print "<pre>";
print_r($data);
print "</pre>";
?>
Where am I going wrong?