Using the power of PHP’s var_dump() displays structured information about one or more expressions that includes its type and value. By definition var_dump() is a debugging tool, which displays structured information about any PHP variable. Below is a handy bit of code using var_dump() to test and verify that a SQL query contains data and view the contents using PHP:
$sql = mysql_query("SELECT * FROM your_table WHERE key = 'value'");
$assoc = mysql_fetch_assoc($sql);
// Dump variable containing the result of the MySQL query
This was a pretty simple example for exporting the results of a SQL query using vardump(). Using this bit of code we will receive structured information about our SQL query that includes its types and values.