Store the result of a SQL query to a PHP variable
Posted: Sat Jan 24, 2004 4:22 am
<br></bog>
</center><br><br><hr>
<?PHP
$conn = pg_Connect ("port=5432 dbname=jack
user=ma103tw");
if (!$conn) {
exit;
}
$result1 = pg_exec ($conn, "select MAX(offender_no) from offenders;");/*this will yield a one figure result*/
$result2 = pg_exec ($conn, "select * from civil_fines where offender = $result;");/*tried to compare offender to the above query result result1, this does not work, i get the error message below:*/
Warning: pg_exec() query failed: ERROR: parser: parse error at or near "id" in public_html/project/enterFine2.php on line 12
if (!$result1) {exit;}
if (!$result2) {exit;}
echo "<b>The client $client has beem added to the database<ol>";
pg_Close($conn);
echo "</ul></b><hr>";
?>
<small><i>
</i></small>
</body></html>
please can anyone help, thanks
</center><br><br><hr>
<?PHP
$conn = pg_Connect ("port=5432 dbname=jack
user=ma103tw");
if (!$conn) {
exit;
}
$result1 = pg_exec ($conn, "select MAX(offender_no) from offenders;");/*this will yield a one figure result*/
$result2 = pg_exec ($conn, "select * from civil_fines where offender = $result;");/*tried to compare offender to the above query result result1, this does not work, i get the error message below:*/
Warning: pg_exec() query failed: ERROR: parser: parse error at or near "id" in public_html/project/enterFine2.php on line 12
if (!$result1) {exit;}
if (!$result2) {exit;}
echo "<b>The client $client has beem added to the database<ol>";
pg_Close($conn);
echo "</ul></b><hr>";
?>
<small><i>
</i></small>
</body></html>
please can anyone help, thanks