Jump to content

aldo151

New Members
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

0 Neutral

About aldo151

  • Rank
    Newbie
  1. Yes, this did it for me Phil...thanks. I think I might be just a bad communicator.
  2. Actually no, this is just adding fields to my query...I already have $sql = "SELECT * FROM orders"; outside of my function if you take a look at the entire code. What I am trying to do is add additional columns to $fields = array('id','type'); .... for example: $fields = array('id','type','etc'); and then have it pass through my function wpquery_select , which its already doing, and then have it add $rows['?'] to display or however I specifiy in my loop, without having me to manually add the columns to echo in the while loop. while($row = $results->fetch_assoc()){ echo $row['id']
  3. Awesome..thanks Phill, by looking at it it makes sense ... I will give this a try.
  4. Thank you but I don't think I'm being clear. Yes I of course I know that, but I would like to specify the colums in my array .... $fields = array('id','type'); then pass it via my function wpquery_select which I am doing and have it dynamically return the columns from the database in the while loop. I don't want to have it static in the while look like... $row['id].$row[type] and so on. Basically would like to have it, where if I add more column names in the $fields = array('id','type'); its automatically taken care of within the fuction.
  5. Hi there, wanted to see how I would have the columns I specified in $fields = array('id','type'); then be generated dynamically in the while loop and any other field I state in $fields = array('id','type'); then its added to the while loop in the below 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
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.