List:General Discussion« Previous MessageNext Message »
From:Alex Gemmell Date:November 30 2005 4:40pm
Subject:Re: Rewriting subquery for old MySQL
View as plain text  
Dan Nelson wrote:
> In the last episode (Nov 30), Alex Gemmell said:
> 
>>I tried splitting up the queries to see if it helped but it didn't
>>work either:
>>
>>[PHP]
>>$query1 = "CREATE TEMPORARY TABLE tmpSubquery
>>	SELECT * FROM tblactivities
>>	WHERE Assignment_ID='".$row['Assignment_ID']."'
>>	ORDER BY Date DESC LIMIT 10;";
>>mysql_query($query1);
>>
>>query2 = "SELECT * FROM tmpSubquery ORDER BY Date ASC;";
>>$result_activities = mysql_query($query2);
>>
>>query3 = "DROP TEMPORARY TABLE tmpSubquery;";
>>mysql_query($query3);
>>[/PHP]
> 
> 
> How do you know it didn't work?  What error message are you getting?
> 

The error I get whichever way IO tried it was the same:

[ERROR]
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result 
resource in C:\alexg\newcs\phpinc\status-Trans.php on line 72
[/ERROR]

The line number always correlated to this bit of PHP code:
$result_activities = mysql_query($query);

Experience tells me this error can mean anything from "no rows in table 
to return" to "the query didn't work at all".  There's defo data there 
to be returned, I'm sure this query just needs tweaking.

Alex
Thread
Rewriting subquery for old MySQLAlex Gemmell30 Nov
  • Re: Rewriting subquery for old MySQLSGreen30 Nov
    • Re: Rewriting subquery for old MySQLAlex Gemmell30 Nov
      • Re: Rewriting subquery for old MySQLrouvas30 Nov
        • Re: Rewriting subquery for old MySQLAlex Gemmell30 Nov
        • Re: Rewriting subquery for old MySQLAlex Gemmell30 Nov
        • Re: Rewriting subquery for old MySQLSGreen30 Nov
      • Re: Rewriting subquery for old MySQLDan Nelson30 Nov
        • Re: Rewriting subquery for old MySQLAlex Gemmell30 Nov
          • Re: Rewriting subquery for old MySQLMichael Stassen30 Nov
      • Re: Rewriting subquery for old MySQLMichael Stassen30 Nov
        • Re: Rewriting subquery for old MySQL - SOLVEDAlex Gemmell30 Nov
          • Re: Rewriting subquery for old MySQL - SOLVED - correction!Alex Gemmell6 Dec