二款postgresql连接数据的方法和操作实例
二款postgresql连接数据的方法和操作实例.
$pg=@pg_connect("host=localhost user=postgres password=sa dbname=employes") or die("can't connect to database."); $query="select * from employes order by serial_no"; //$query="insert into employes values(10008,'susan','1985-09-04','80','50')"; $result=@pg_query($pg,$query) or die("can't run query to table."); //echo pg_num_rows($result); //输出多少条记录被查询 //if($result) //{ //echo "recrods inserted sucessfully!"; //echo pg_affected_rows($result);//输出多少条记录被插入 //} //实例一[pg_fetch_row] echo ""; echo ""; echo "serial_no"; echo"name"; echo"birthday"; echo""; for($i=0;$i"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);
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号