pgsql query into variable
<p>I am using this output with another script and retrieving it as a include, Is there a way to load the <code>"echo "$row[0],\n";"</code> into a variable where I wont have to do a include?
right now I'm doing a include on my other script.</p>

<pre><code> $conn = pg_pconnect("host=localhost dbname=xsoft user=sx");
    if (!$conn) {
    echo "An error occured.\n";
    exit;
    }

$result = pg_query($conn, "SELECT phones.phone FROM phones");
if (!$result) {
echo "An error occured.\n";
exit;
}
while ($row = pg_fetch_row($result)) {
echo "$row[0],\n";
}
</code></pre>
