简体   繁体   中英

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.

Query to run in 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:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\\wamp\\www\\tracker\\inc\\common.php on line 489

Other similar queries work fine in same script (different job_titles).

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!!!

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'

Did you mean for that entire string to be the job_title ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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