Click here to Skip to main content
15,895,557 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have problem in database query. The query that I have is:

SQL
SELECT
                      DATE_FORMAT(LAST_DAY(NEWSP_MONTH),'%d') as Last,
                      MIN(NPDAY) AS NPDA, ifnull(MAX(NPDAY),0)+01 AS NPDAY, np.NEWSP_RACKNO,   np.NEWSP_MONTH,  np.NEWSPID FROM
                      newspaper AS np, newspaper_days AS npd
                      WHERE np.NEWSPID = npd.NEWSPID AND
       np.NPID =$newspaper AND np.CITYID = $city AND np.NEWSP_MONTH = $monthYear


This query executes successfully in Wamp where version details are:

Apache version: 2.4.4
PHP version: 5.4.12
MySQL version: 5.6.12

But the same query, on an Apache server, returns this error:


Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in D:\AppServ\www\archives\app\archive\checkmonth.php on line 68


The version details of the Apache server are:

Apache version: 2.2.8
PHP version: 5.2.6
MySQL version: 5.0.51b

On line 68 there is a variable consisting of the above mentioned query.

Help is greatly appreciated, thanks.
Posted
Comments
Mehdi Gholam 4-Oct-13 4:17am    
Try upgrading your PHP.
PrinceFayyaz 5-Oct-13 1:21am    
Yes that would be one way of doing it. But would it be called a solution? At this moment I cannot go for that. Though I have found in my research that using Group by clause I can retrieve what I want. Only experts can tell me if that actually is the solution, and i am no expert. Thanks for your suggestion.
Mehdi Gholam 5-Oct-13 4:03am    
Anything that works *is* a solution.
Maciej Los 25-Nov-13 14:03pm    
Check PHP code instead an sql query content...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900