【问题标题】:PHP read specific row [closed]PHP读取特定行[关闭]
【发布时间】:2011-11-20 14:20:21
【问题描述】:

我有一个显示从 MySQL 数据库读取的数据的 PHP 脚本。我想过滤输出以仅显示两列包含特定值的行。我该怎么做?

【问题讨论】:

  • 请出示相关代码。
  • @Valle deutschsprachige PHP- und mySQL-Tutorials gibts hier: peterkropff.de

标签: php mysql database filter


【解决方案1】:

添加WHERE 子句,例如WHERE column1 = 'specific-value1' AND column2 = 'specific-value2'

这里是 MySQL 的 SELECT 语法的链接:

http://dev.mysql.com/doc/refman/5.1/en/select.html

(德语):

http://dev.mysql.com/doc/refman/5.1/de/select.html

【讨论】:

    【解决方案2】:

    不知道你为什么要在英文网站上用德文发帖,然后再翻译成英文。但是你需要做的是像“select * from table where column1='val' and column2='val'”。尽管听起来您已经提取了大量数据并且您想要对其进行过滤。我不明白为什么你不应该只从数据库中查询你需要的东西,而不是把所有东西都拉出来然后过滤。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-08-12
      • 1970-01-01
      • 2016-07-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-12
      相关资源
      最近更新 更多