> -----Original Message-----
> From: Jim Lucas [mailto:[EMAIL PROTECTED]
> Sent: Monday, September 08, 2008 2:38 PM
> To: Richard Kurth
> Cc: PHP General List
> Subject: Re: [PHP] pulling data from array

---8<--- snip

> > $query1 = "SELECT sponserrep,rep,firstname,lastname,phonenumber FROM
> > contacts WHERE members_id = '8' AND sponserrep != ''";
> > $result1=mysql_query($query1);
> > $num_rows = mysql_num_rows($result1);
> > while($row1=mysql_fetch_array($result1)){
> 
> Change the previous line to this
> 
> while ( $row1 = mysql_fetch_assoc($result1) ) {
> 
> > $customf_array[]=$row1[0] . "," . $row1[1] . "," . $row1[2] . "," .
> > $row1[3];
> 
> Change the previous line to this
> 
> $customf_array[] = $row1;

Gahhh... I've been working with ASP.NET too much recently. I didn't even
see that he wasn't fetching the row as an associative array. I seem to
remember using mysql_fetch_row() for it when I was doing more
PHP/DB-oriented coding. Object instantiation to contain a row of
information that could already be accessed methodically and easily was a
bit of overkill in my "solution." :)

Cheers,


Todd Boyd
Web Programmer




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

Reply via email to