donglang1976 2013-08-04 02:56
浏览 37
已采纳

我应该让php处理它或将所有数据转储到数据库[关闭]

Hi i am using php and mysql on my project and i wanted to know which is better (all aspect).
I am expecting a big amount of data in the database.
I want it to search faster.


Should i store the real value or a reference value.
1) Have php proccess it? Meaning I will store values in the database as integer/tinyint and then create a function to know the value to output. ie. if 1 then value is "north" elseif 2 then value is "east" and so on. values will not change.

let say i will have at least 20 of this function.

database design
id direction
1 1 (1=north)


output (use php to display the output)
north



2) Dump all data to database.

database design
id direction
1 north

  • 写回答

3条回答 默认 最新

  • duanpuchen3142 2013-08-04 03:12
    关注

    Will the data change overtime, or are they fixed?

    If the data can change, better store them in database so you don't have to keep changing your PHP code and just update the data in database as needed.

    If the data is fixed, then just store it in PHP. Maybe you can just store it as array and access the record as needed.

    $data = array (1 => 'i am one', 2 => 'i am two', 3 => 'etc');
    echo "{$data[1]}"; // will output 'i am one'
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥170 如图所示配置eNSP
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥15 键盘指令混乱情况下的启动盘系统重装