Introduction: This is a detailed page for PHP to operate on PostgreSQL. It introduces related knowledge, skills, experiences, and some PHP source code.
Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 336863 'rolling = 'no'>
<? PHP # $ id = $ _ Get ['id']; # $ db = pg_connect ("host = localhost dbname = test user = s Password = test "); # $ query = 'select * from test where id = '. $ ID; # $ result = pg_query ($ query) or die ('query failed :'. pg_last_error (); # echo "<Table> \ n"; # While ($ line = pg_fetch_array ($ result, null, pgsql_assoc )) {# echo "\ t <tr> \ n"; # foreach ($ line as $ col_value) {# echo "\ t <TD> $ col_value </TD> \ n" ;#}# E Cho "\ t </tr> \ n" ;#}## echo "</table> \ n"; # pg_free_result ($ result); # pg_close ($ dB ); if (isset ($ _ Get ['id']) {$ id = $ _ Get ['id'];} else {$ id = 1 ;} $ db = pg_connect ("host = 192.168.1.105 dbname = test user = s Password = test"); $ query = 'select * from test where id = '. $ ID; echo "<HR/>"; echo 'id = '; echo "<br/>"; echo 'id = '. $ ID; echo "<br/>"; echo $ query; echo "<HR/>"; $ result = pg_query ($ query) or die ('query failed :'. PG _ Last_error (); echo "<Table> \ n"; while ($ line = pg_fetch_array ($ result, null, pgsql_assoc )) {echo "\ t <tr> \ n"; foreach ($ line as $ col_value) {echo "\ t <TD> $ col_value </TD> \ n";} echo "\ t </tr> \ n ";} echo "</table> \ n"; pg_free_result ($ result); pg_close ($ dB);?>
[Size = x-small] [/size]
More articles on "php PostgreSQL operations"
Love J2EE follow Java Michael Jackson video station JSON online tools
Http://biancheng.dnbcw.info/php/336863.html pageno: 9.