Re: var_dump() results

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Europus wrote:
Actually, it doesn't exactly iterate the 1st row 4 times, it's a bit
more convoluted.

The table as 4 columns:
1 - int, primary, auto-incrementer
2 - varchar() values
3 - varchar() values
4 - varchar() values

and 2100 rows. The return is 4 rows of this:

array(4) {
[0]=> string(11) "col_1_row_1_data" ["col_1"]=> string(11) "col_1_row_1_data" [1]=> string(13) "col_2_row_1_data" ["col_2"]=> string(13) "col_2_row_1_data" }

This is way beyond my ken, but I want to learn so I'll keep plugging
at it. Tips & suggestions are welcome....

Ulex

Yes well looking at the starting code i realise i forgot something. Sorry for that.
When doing mysql_fetch_array or mysql_fetch_row you get only one row.
So what you want to do is loop through the result set:

$result = mysql_query($sql);

//loop through to display results
while ($row = mysql_fetch_array($result)) {
   var_dump($row);
   echo "<br /><br />";
}

P.s. Please reply to the list also :)

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux