| 代码如下 | 复制代码 | |||
|
$pg=@pg_connect("host=localhost user=postgres password=sa dbname=employes") //$query="insert into employes values(10008,'susan','1985-09-04','80','50')"; //实例一[pg_fetch_row]
for($i=0;$i { $row=@pg_fetch_row($result) or die("can't fetch row from table."); | ||||
| $serial_no | $name | $birthday | ||
}
echo"
//实例二[pg_fetch_array]
//echo "
| serial_no | name | birthday |
| $serial_no | $name | $birthday |
//增加,删除,修改实例
//$newrow=array("serial_no"=>"1006","name"=>"peter","birthday"=>"1990-07-03","salary"=>"90","bonus"=>"80");
//$reusult=@pg_insert($pg,"employes",$newrow) or die("can't insert data to table.");
//if($reusult)
//{
//echo "rechords inserted sucessfully!";
//}
//
pg_close($pg);