Yeah...see...I'm confused apparently!

My while loop is getting all of the names correctly, apparently my problem
is...once i get them, how do I echo each one out seperately?

Based off of the print_r($cs_row) I can see all of the names. What should I
be doing differently to output each name into my table?

What you're doing wrong:

Assume mssql_fetch_array($cs_type) has two rows:
request_type = 'type1', first_name = 'Bob', last_name = 'Consumer'
request_type = 'type2', first_name = 'Alice', last_name = 'Cooper'

So we can replace it with a variable $array that has the same data.
$array = array(
        array(
                'request_type' => 'type1',
                'first_name' => 'Bob',
                'last_name' => 'Consumer'
        ),
        array(
                'request_type' => 'type2',
                'first_name' => 'Alice',
                'last_name' => 'Cooper'
        ),
);

Then this:

while ($cs_row = iterator($array)) {
        $cs_type2 = $cs_row['request_type'];
        $cs_name = $cs_row['first_name']." ".$cs_row['last_name'];
        print_r ($cs_row);
}

Is functionally the same as:

$cs_type2 = $array[0]['request_type'];
$cs_name = $array[0]['first_name']." ".$array[0]['last_name'];
print_r ($array[0]);

$cs_type2 = $array[1]['request_type'];
$cs_name = $array[1]['first_name']." ".$array[1]['last_name'];
print_r ($array[1]);

Now.  Why would the print_r return the right information?

Because, you're printing it for EACH row.

Why would the variable $cs_type2 have only the information of the last row?

Because, you're OVERwriting it on EACH row.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to