Jump to content


Photo

Difficulty reading array


  • Please log in to reply
1 reply to this topic

#1 solarisuser

solarisuser
  • Members
  • PipPipPip
  • Advanced Member
  • 122 posts

Posted 14 April 2006 - 01:02 AM

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

$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";

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

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

I'm so confused! =(


#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 14 April 2006 - 04:56 AM

Why are you confused? What were you expecting to see?

Ken




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users