我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

应用程序中的数据库连接

I am developing a application that is in php and PostgreSQL.

What I want to know is which of these is best?

  1. I should create connection every time i have to make a query like using pg_connect and close it after the query operations
  2. Or should i start the connection first time at the initial launch

Please guide me the correct way to achieve my objective.

Connect at the start of your script, close it at ending. No need to re-connect on each query.

近期文章

  • 从cron运行时找不到PHP扩展SSH2
  • 在邮件正文php脚本中发送图像
  • 带有PREG_SPLIT_DELIM_CAPTURE标志的preg_split仍然会使用分隔符
  • PHP文件上传到NGINX和PHP5-FPM
  • PHP静态方法和静态变量,我的解决方案是否正确?
  • RewriteRule重定向到php文件无法正常工作
  • PHP网站用户之间的转移号码
  • 为什么我使用$(“#myform”)错过了一些帖子值.serialize()?
  • Wordpress PHP自定义字段 - 幻灯片显示的单个链接
  • 从文件中获取价值 - php
  • 在basename wordpress过滤器中不能使用$ 1
  • PHP如何循环多个注释级别
  • base64字符串已更改为[已删除]
  • 在php和mysql中链接[重复]
  • 从浏览器中启动文件复制并在浏览器中显示进度
  • 如何从codeigniter中的数据库获取子类别达到n级别
  • 从哪里开始在Android中的Web服务?
  • PHP测验中的SQL查询错误
  • 重力形式和验证功能
  • 将朋友照片插入数组中的数据库中

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华