duanchuang6978 2012-05-11 18:43
浏览 33

SQL查询没有错误消息

EDIT: Found the error. The sting replace statement was adding an extra space. Fixed now, thanks.

I've been looking at this too long, I can't find the error.

Here's what I've got:

echo $client_name." - ".$location;  
$query = mysql_query("SELECT * FROM spc_clients WHERE (client_name='".$client_name."' AND location='".$location."')") or die(mysql_error());  
while ($results = mysql_fetch_array($query)) {  
    // Other code...
}

When I echo, I get 'Client1' and 'Location1". When I put the SQL query into PHPMyAdmin, and replace those values, the query runs fine and brings up results. On the page it's on, I get nothing.

I have no syntax errors, and the mysql_error isn't coming back with anything either.

What am I missing?

  • 写回答

2条回答 默认 最新

  • duankui1532 2012-05-11 18:49
    关注

    try this

    $query = mysql_query("SELECT * FROM spc_clients WHERE client_name="'.$client_name.'" AND location="'.$location.'" ") 
    
    评论

报告相同问题?

悬赏问题

  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型
  • ¥50 buildozer打包kivy app失败
  • ¥30 在vs2022里运行python代码
  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
  • ¥15 求解 yolo算法问题