Jump to content

Difficulty reading array


solarisuser

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! =(
Link to comment
https://forums.phpfreaks.com/topic/7366-difficulty-reading-array/
Share on other sites

Archived

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

×
×
  • 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.