Skip to content

Commit

Permalink
PGSQL examples should specify the $connection parameter (php#4096)
Browse files Browse the repository at this point in the history
This behaviour was deprecated, and the manual should ideally only have deprecation free code examples.
  • Loading branch information
mmalferov authored Nov 18, 2024
1 parent 71fa455 commit aa2e1ac
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion reference/pgsql/examples.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@
<programlisting role="php">
<![CDATA[
<?php
// Connecting, selecting database
$dbconn = pg_connect("host=localhost dbname=publishing user=www password=foo")
or die('Could not connect: ' . pg_last_error());
// Performing SQL query
$query = 'SELECT * FROM authors';
$result = pg_query($query) or die('Query failed: ' . pg_last_error());
$result = pg_query($dbconn, $query) or die('Query failed: ' . pg_last_error());
// Printing results in HTML
echo "<table>\n";
Expand All @@ -37,6 +38,7 @@ pg_free_result($result);
// Closing connection
pg_close($dbconn);
?>
]]>
</programlisting>
Expand Down

0 comments on commit aa2e1ac

Please sign in to comment.