pg_select

(PHP 4 >= 4.3.0, PHP 5, PHP 7)

pg_select 选锟斤拷锟铰�

说锟斤拷

pg_select ( resource $connection , string $table_name , array $assoc_array [, int $options = PGSQL_DML_EXEC ] ) : mixed

pg_select() 锟斤拷锟斤拷 assoc_array 锟斤拷锟斤拷锟叫碉拷 field=>value 值锟斤拷选锟斤拷锟铰硷拷锟斤拷晒锟斤拷牟锟窖拷锟斤拷睾锟� assoc_array 指锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷匹锟斤拷陌锟斤拷锟斤拷锟铰硷拷锟斤拷侄蔚锟斤拷锟斤拷椤�

锟斤拷锟街革拷锟斤拷锟� options锟斤拷pg_convert() 锟结按锟斤拷指锟斤拷选锟斤拷锟斤拷锟斤拷锟斤拷 assoc_array 之锟较★拷

Warning

锟剿猴拷锟斤拷锟斤拷实锟斤拷锟斤拷锟侥★拷锟剿猴拷锟斤拷锟侥憋拷锟襟,帮拷锟斤拷锟斤拷锟狡硷拷锟斤拷锟斤拷锟斤拷牡锟斤拷锟斤拷锟斤拷锟斤拷锟轿达拷锟斤拷锟� PHP 锟斤拷锟斤拷锟芥本锟斤拷未通知锟酵憋拷锟睫改★拷使锟矫憋拷锟斤拷锟斤拷锟斤拷锟斤拷锟皆碉拷 锟斤拷

锟斤拷锟斤拷

connection

PostgreSQL 锟斤拷锟捷匡拷锟斤拷锟斤拷锟斤拷源锟斤拷

table_name

Name of the table from which to select rows.

assoc_array

An array whose keys are field names in the table table_name, and whose values are the conditions that a row must meet to be retrieved.

options

Any number of PGSQL_CONV_FORCE_NULL, PGSQL_DML_NO_CONV, PGSQL_DML_EXEC, PGSQL_DML_ASYNC or PGSQL_DML_STRING combined. If PGSQL_DML_STRING is part of the options then query string is returned.

锟斤拷锟斤拷值

锟缴癸拷时锟斤拷锟斤拷 TRUE锟斤拷 锟斤拷锟斤拷锟斤拷失锟斤拷时锟斤拷锟斤拷 FALSE锟斤拷 Returns string if PGSQL_DML_STRING is passed via options.

锟斤拷锟斤拷

Example #1 pg_select() example

<?php 
  $db 
pg_connect('dbname=foo');
  
// This is safe, since $_POST is converted automatically
  
$rec pg_select($db'post_log'$_POST);
  if (
$rec) {
      echo 
"Records selected\n";
      
var_dump($rec);
  } else {
      echo 
"User must have sent wrong inputs\n";
  }
?>

锟轿硷拷

  • pg_convert() - 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷值转锟斤拷为锟绞猴拷 SQL 锟斤拷锟侥革拷式锟斤拷