Re: var_dump() results

From: Date: Sun, 13 Jan 2008 18:20:21 +0000
Subject: Re: var_dump() results
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-267187@lists.php.net to get a copy of this message
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 :)

« previous php.general (#267187) next »