php - MySQL query results are not a resource -
I have trouble with the query in this code. The problem is that I have previously, $ num = Mysql_num_rows ($ result);
The part tells me a MySQL error that it expects a resource. Normally when I am getting this error, I have lost a single quote, but I see that I am not getting any problem, although this question is a bit more complex which I have to deal with usually.
// Connect to database and $ last_year = idate ("Y") - 1; $ Month = date ("m"); $ Day = date ("D"); $ Query = "SELECT bills.b_id, bills.c_id, Bill.Gr_tatic, bill.voice, bilceddated, customer.b_name, customer.l_name, customer.f_name, customer.phone bills, customers WHERE bill c_id = customer. C_id and bill.is = '0' and added between date ''. $ Last_year. "-". $ Month "-". $ Day. "'And kurt ()"; $ result = mysql_query ($ query); Mysql_close ($ link); $ Num = mysql_num_rows ($ result);
Edit:
Although I already know mysql_close ()
function problem I can not move forward And removed it and my code still does not work. It works in about a dozen other pages similar to EXACT (in addition to the query). The problem is in the query MySQL error (as previously mentioned) is mysql_num_rows () value of 1 parameter being resource
. I am now working on getting specific error.
Add some error handling to your code.
$ result = mysql_query ($ Query); If (! $ Result) {echo 'query failed:', mysql_error (); Die; }
(You do not want to display the actual query and error message to any arbitrary user in the "real" output code).
Also see:
Comments
Post a Comment