Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    RRT
    RRT is offline
    New to the CF scene
    Join Date
    Feb 2012
    Posts
    6
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question how to separate individual fields instead of $col_value

    Can someone show me a short example of how to separate individual fields pulled from a line of code such as this:

    while ($line = pg_fetch_array($inventoryresult, null, PGSQL_ASSOC)) {

    foreach ($line as $col_value) {
    echo "$col_value\n";
    echo "\t</tr>\n";
    }
    echo "</table>\n";

    I want better control over each specific field than this method dumps out.
    Thanks.

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    Simply replace what is inside the foreach loop with the code to handle each individual field the way you do want or replace the entire loop with separate code for each property within the $line object that you want to process.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #3
    RRT
    RRT is offline
    New to the CF scene
    Join Date
    Feb 2012
    Posts
    6
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Could you post a small example? Nothing fancy by any means, but I am totally having writers block....
    Last edited by RRT; 04-15-2012 at 11:53 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •