Skip to content

Commit aa2e1ac

Browse files
authored
PGSQL examples should specify the $connection parameter (#4096)
This behaviour was deprecated, and the manual should ideally only have deprecation free code examples.
1 parent 71fa455 commit aa2e1ac

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

reference/pgsql/examples.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@
1313
<programlisting role="php">
1414
<![CDATA[
1515
<?php
16+
1617
// Connecting, selecting database
1718
$dbconn = pg_connect("host=localhost dbname=publishing user=www password=foo")
1819
or die('Could not connect: ' . pg_last_error());
1920
2021
// Performing SQL query
2122
$query = 'SELECT * FROM authors';
22-
$result = pg_query($query) or die('Query failed: ' . pg_last_error());
23+
$result = pg_query($dbconn, $query) or die('Query failed: ' . pg_last_error());
2324
2425
// Printing results in HTML
2526
echo "<table>\n";
@@ -37,6 +38,7 @@ pg_free_result($result);
3738
3839
// Closing connection
3940
pg_close($dbconn);
41+
4042
?>
4143
]]>
4244
</programlisting>

0 commit comments

Comments
 (0)