drzbc6003 2013-01-18 08:50
浏览 29

使用mysql_函数与mysql连接?

I have written some code that is using mysqli_ a lot. The problem is that I now need to integrate this code with code that is using mysql_, and takes care of connection, authentication etc. I don't want to create a second connection, but mysql_ lacks a few features, for example, prepared queries. So I'd like to somehow magically "import" the connection into mysqli. Is this even possible? If so, how can that be done?

  • 写回答

3条回答 默认 最新

  • duanquanzhi5560 2013-01-18 08:54
    关注

    As F4r-20 pointed out, you could just change the way you connect to the database and replace the mysql_ functions with msqli_ ones!

    Try to decide what you are going to use BEFORE you start a project, not in the middle. Preparing saves a lot of time and issues like this.


    PS. I would use PDO next time. It is easy, fast, OOP and supports multiple database types!


    Edit: since you don't have access to the credentials or how you connect to the database, you will have to use mysql_, change the connection to mysqli_ or make a new connection... Sorry :(

    评论

报告相同问题?

悬赏问题

  • ¥20 易康econgnition精度验证
  • ¥15 线程问题判断多次进入
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致