I have an array with a list of column names in it. I want to retrieve data from the columns in a database table by getting the column names from my array. I have tried the following but I get the error:
Notice: Undefined property: stdClass:
My code:
while($row = $dateResult->fetch_object()) {
echo "<tr>";
for($k=0; $k<count($collumnNames); $k++) {
echo "<td>";
echo $row->$collumnNames[$k];
echo "</td>";
}
echo "</tr>";
}