PHP MYSQL显示打开状态

时间:2016-08-24 12:03:50

标签: php mysql

我需要修改此脚本以仅显示Open记录。字段称为statusRP

$result = mysql_query("select id, ref, company, title, forename,
                              surname, tel, fax, mob, statusRP, email 
                       from Client");

  if (!$result) {
      die("Query to show fields from table failed");
  }

   $fields_num = mysql_num_fields($result) ;

2 个答案:

答案 0 :(得分:0)

查询表格中的字段失败

 $result = mysql_query("select id, ref, company, title, forename, surname, tel, fax, mob, statusRP, email from Client, WHERE statusRP = 'Open';");

  if (!$result) {
      die("Query to show fields from table failed");
  }

   $fields_num = mysql_num_fields($result) ;

答案 1 :(得分:0)

根据我的理解,

$result = mysql_query("select id, ref, company, title, forename, surname, tel, fax, mob, statusRP, email from Client WHERE Client.statusRP = 'Open'";) 

还有一件事,使用mysqli而不是mysql(如果mysql不是你的要求)。我认为这将是有效的。