PHP - list() 查询不工作

标签 php mysql

当我在 $entry = miami.com 时运行下面的代码时,我收到以下错误消息:

SELECT COUNT(*) FROM #&*+ WHERE `site`
LIKE 'miami.com':You have an error in
your SQL syntax; check the manual that
corresponds to your MySQL server
version for the right syntax to use
near '' at line 1

It looks like I'm not correctly defining $table. Any ideas how I could do that?

Thanks in advance,

John

    $result = mysql_query("SHOW TABLES FROM feather") 
or die(mysql_error()); 


while(list($table)= mysql_fetch_row($result))
{
  $sqlA = "SELECT COUNT(*) FROM $table WHERE `site` LIKE '$entry'";
  $resA = mysql_query($sqlA) or die("$sqlA:".mysql_error());
  list($isThere) = mysql_fetch_row($resA);
  if ($isThere)
  {
     $table_list[] = $table;
  }
}

最佳答案

如果是我调试我会看到什么

print_r(mysql_fetch_row($result));

输出

关于PHP - list() 查询不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/999709/

相关文章:

php - 用 html mailto 标签替换字符串 php

php - 使用数组索引运算符访问类常量的子字符串

mysql - 我可以从 MySQL 中检索数据作为数组吗?

mysql - 将数据从 MySQL 迁移到 Orbeon Forms 中的 eXist

php - 如何在我的本地计算机(Ubuntu)上测试 php 代码?

php - 记录未显示在 MySQL 中,但我可以在 PHP 中通过 ID 获取它

php - Symfony:如何在 Bundle Controller 中调用私有(private)服务

php - 解析使用 GD 库创建的临时文件图像对象以解析 mPDF 中的 GIF 图像时出错

javascript - 切换 PHP 表上的复选框

MySQL更新列,这是另一列中的值