1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-23 23:32:18 +01:00

PGSQL examples should specify the $connection parameter (#4096)

This behaviour was deprecated, and the manual should ideally only have deprecation free code examples.
This commit is contained in:
Mikhail Alferov
2024-11-18 17:45:01 +03:00
committed by GitHub
parent 71fa455c56
commit aa2e1accf0

View File

@@ -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";
@@ -37,6 +38,7 @@ pg_free_result($result);
// Closing connection
pg_close($dbconn);
?>
]]>
</programlisting>