I have just used a select with a select for the first time. It seems to work and I am getting the desired result when I run it in phpMyAdmin. However, when I then use $variable = mysql_num_rows($queryresult);
I get nothing. I guess it is null or something as it won’t echo. This is the query:
$resultxl = mysql_query(select * from (Select * from mon_content_lid where mon_date_last!='0000-00-00' ORDER BY lid, mon_date_last desc) as x group by `lid`);
$numx1 = mysql_num_rows($resultxl);
echo $numx1;
No result.
2
Answers
If I see it right (didn’t tried it out), you do a SELECT an put the result in a virtual column x, so in my opinion, x should be the only delivered column. This one you group by ‘lid’.
So ‘lid’ is, if it is quoted, a text, not a column-name. Try the query qithout the “group” and dump the cursor, maybe you see some results.
Don’t use mysql, use the mysqli functions.
If i’m right you can’t use the mysql functions in php7 anymore
I didn’t test is, but i think this should work.
If it still don’t work try to see if there are any errors.