A
Anonymous
Guest
Hi there, wanted to see how I would have the columns I specified in
then be generated dynamically in the while loop and any other field I state in
then its added to the while loop in the below
Code:
$fields = array('id','type');
Code:
$fields = array('id','type');
Code:
include('db.php');
class SelectData{
public function wpquery_select($conn,$sql,$fields){
$results = $conn->query($sql);
if($results->num_rows > 0){
while($row = $results->fetch_assoc()){
// How would you process the array $fields which holds all the rows specified and dynamically create echo $row['id'], $row['id'] and so on?
}
}
$conn->close();
}
}
$select = new SelectData();
$sql = "SELECT * FROM orders";
$fields = array('id','type');
$select->wpquery_select($conn,$sql,$fields);