Re: var_dump() results
| From: | Europus | Date: | Sun, 13 Jan 2008 18:31:29 +0000 |
| Subject: | Re: var_dump() results | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-267188@lists.php.net to get a copy of this message | ||
Jochem Maas wrote:
side note: where does $table come from?I didn't want to reveal the real names of my server/host, table, login or password to the list, so I tried setting $host, $login, $passwd, and $table variables at the top of the script. That way it's 4 lines to omit when posting code, instead of parsing through to edit each instance. That didn't work so I've since restored the initial values, probably I stepped on a reserved word. I'll check on that, I like the idea of setting those to variables elsewhere.
Now that, that change makes what looks to be 2100 rows of data flood the screen, thank you. Now I can move on to processing that data in the next step of my script. It looks like, my take-away lesson is that I was invoking var_dump() too late, I should have been performing that check right after running mysql_fetch_array(), because later operations step on the data and that's why I was getting unexpected returns. Ulex//get column dataif (!$result) {$sql = "SELECT column2, column3 FROM $table"; $result = mysql_query($sql);echo "query failed.\n";} else {while ($row = mysql_fetch_array($result)) var_dump($row); }$row = mysql_fetch_row($result);