简体   繁体   English

使用PHP我发出一个MySQL数据库的简单查询-当在phpMyAdmin中发出相同查询时,我得到一个错误,我得到信息行

[英]Using PHP I issue a simple query of a MySQL database - I get an error, when issuing the same query in phpMyAdmin I get rows of information

I've run this on my local windows machine and on an ubuntu server with the same results. 我已经在本地Windows机器和ubuntu服务器上运行了此程序,结果相同。

Query to run in PHP: 查询要在PHP中运行:

$job_sql="SELECT * FROM job WHERE job_title = 'SIP Opportunities where sipsubmitted EQ 1 and still in BAB PROCESS'";

$job_ret = mysql_query($job_sql);

$job_row = mysql_fetch_array($job_ret,MYSQL_ASSOC);

Error from PHP Script: 来自PHP脚本的错误:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\\wamp\\www\\tracker\\inc\\common.php on line 489 警告:mysql_fetch_array():489行上的C:\\ wamp \\ www \\ tracker \\ inc \\ common.php中提供的参数不是有效的MySQL结果资源

Other similar queries work fine in same script (different job_titles). 其他类似的查询可以在相同的脚本中正常工作(不同的job_titles)。

phpMyAdmin: phpMyAdmin:

SELECT * 
FROM job
WHERE job_title = 'SIP Opportunities where sipsubmitted EQ 1 and still in BAB PROCESS'
LIMIT 0 , 30

Showing rows 0 - 0 (1 total, Query took 0.0004 sec) - successfully found the row!!! 显示行0-0(共1行,查询耗时0.0004秒)-成功找到行!

Looks like you may have misplace a single quote in your example code. 看起来您可能在示例代码中放了一个单引号。 With the code as it is now, you're looking for the following job title: 有了现在的代码,您正在寻找以下职位:

'SIP Opportunities where sipsubmitted EQ 1 and still in BAB PROCESS' 'SIP提交了EQ 1并仍在BAB过程中的机会'

Did you mean for that entire string to be the job_title ? 您是说job_title整个字符串成为job_title吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM