douxiluan6555 2017-11-09 13:56
浏览 31
已采纳

从网站设置与数据库的连接并运行查询

I am working on a project for a Database Systems class where we created a database and have to present it somehow. Our group had the idea to create an 'imdb' type website where various information about movies could be stored and presented to the user. We have our database created and are about to begin work on the front-end for the website.

We have some confusion among our group as to how to proceed. We understand that we need to use PHP to connect to the database with the username and password credentials, but from there:

  • Do you have to have the PHP connection code on every webpage, or just the home page?
  • What do the queries look like when communicating with the database to retrieve and display data?
  • Would a WordPress site be easier to use when working in this capacity as it's more or less a 'Proof of Concept' type project, not a fully fleshed out site?
  • 写回答

2条回答 默认 最新

  • douyun1972 2017-11-09 14:13
    关注

    Here are your answers:

    1. Yes- you will need to have the connection on every page. Usually, the connection parameters and script is located in one file which you require on every page.

    2. A query looks like:

      SELECT `name` FROM `movies` ORDER BY ID DESC LIMIT 0, 10;
      
    3. You may find some WordPress plugins which will do something similar. If it's a proof of concept, then I suggest you go this way (if such a plugin exists). It's also a good idea to read extensively on PHP/MySQL development or hire someone who can do that if you want to make that project real.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法
  • ¥15 如何绘制动力学系统的相图