Re: var_dump() results

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

 



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.

//get column data
    $sql    = "SELECT column2, column3 FROM $table";
    $result = mysql_query($sql);

if (!$result) {
    echo "query failed.\n";
} else {
    while ($row = mysql_fetch_array($result))
        var_dump($row);
}

    $row = mysql_fetch_row($result);

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

--
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