Jump to content

Archived

This topic is now archived and is closed to further replies.

solarisuser

Difficulty reading array

Recommended Posts

I can't seem to the array to give me any values. Below is the code I have...

FYI : the values of first, second, third, fourth, and fifth are Y,N, Y, Y, N

[code]
$idnum = 1;
$statement = "SELECT first,second,third,fourth,fifth FROM maindb where id=$idnum";

$result = mysql_query($statement);
$data=array();
        while($row=mysql_fetch_array($result,MYSQL_NUM)){
        $data[]=array(
        'first' => $row[0],
        'second' => $row[1],
        'third' => $row[2],
        'fourth' => $row[3],
        'fifth' => $row[4]);
extract($data, EXTR_PREFIX_SAME, "wddx");
}
print "$first is first";
[/code]

When I do a print_r($data), I get this:

[code]
Array
(
     [0] => Array
           (
                  [first] => Y
                  [second] => N
                  [third] => Y
                  [fourth] => Y
                  [fifth] => N
           )
)
[/code]

I'm so confused! =(

Share this post


Link to post
Share on other sites
Why are you confused? What were you expecting to see?

Ken

Share this post


Link to post
Share on other sites

×

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.