drtsd7864 2014-02-19 13:14
浏览 16
已采纳

在.php文档中显示不同的mysql数据,如cms

Hey this is probably really simple, but i am still a beginner i am a bit confused about that.. I want to create something like a selfmade CMS for my website.

I have a .php document which is querying certain data from my database. Now if i change that data, the document will display the new data. (So i can edit my texts and images..)

My actual question is, how can i create something like a new page. So that i have a form which will write new data into my database and the .php document somehow displays my new data. I mean it is the same "template" like my first .php document, but how can i query different things from my database than before? How does that work in real CMS systems?

Basically i want to write new data in my database with a form. And depending on which url i will click in my index.php, different data is shown in my page1.php document.

I hope you know what i mean. Thank you

EDIT:

To give you an example: A main document with a lot of url's named "data1" "data2" "data3" and so on. If i click on "data2" the showdata.php document should display the data2 which it will find in the database.

  • 写回答

2条回答 默认 最新

  • douwei1944 2014-02-19 13:48
    关注

    Have you tried using the data in the url to write different queries ?

    Something like:

    if (data1) {select data1 from database} elseif(data2){select data2 from database}
    

    and so on ? This is what a CMS does actually it, shows different data on the same page based on the url parameters which in php you can use as $_GET['data1'] or $_REQUEST['data1']

    Try something like that then update your answer with some code.

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

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么