Nested/Subqueries cuasing syntax erros using mysqli extension; though syntactically correct?

Because mysqli_query can't run more than one query.

Thanks for pointing that out- Yes, though I'm just referencing a suggestion I researched but is no longer valid (question now updated) thank you. It seems to be only when SET @var = x is used in the query – user885983 Sep 10 at 23:42 @user885983: Yes, that's exactly that problem. SET @var = x is first query, SELECT is second one.

– genesis Sep 10 at 23:44 I see, are you saying I should therefore split the query (using multi_query? ) and store the SET @var = x as a stored query? And then reference that with the second half of the query.. – user885983 Sep 10 at 23:51 I should therefore split the query (using multi_query?) this – genesis Sep 10 at 23:59 I'm sorry I may be mistaken but I do not understand the need /how for using multi_query for example this (albeit unnecessary) query uses a nested query but executes Ok without multi_query: SELECT FileName FROM ( SELECT virtualFolderName, photoFileName FROM photos WHERE idUser = '67' ORDER BY UploadTimestamp DESC) AS mySubquery WHERE FileName = 'filename.

Txt' – user885983 Sep 11 at 0:18.

I'm using the mysqli improved extension (procedural style) and have just ran into an anomaly when running sub-queries through the mysqli_query() function. Update: After much troubleshooting I've found the cause of the error is setting the '@rank' variable. I tried a query without setting such '@var's and works fine.

But they are needed... - Does PHP not pass 'SET @example = x' correctly to mysql, or need to be escaped somehow? The query executes correctly within Phpmyadmin and similar posts direct towards the multi_query method however this doesn't seem to be a query that can be split into multiple queries? The query is dynamic (it gets passed a filename) though this is escaped and not the cause.

Finally the query is within a mysqli_fetch_array loop though variables have been checked for same-name conflict. The sql @rank variable is set to -1 in order for the fetched array to be indexed at 0. The query is simply uses to identify the row number from a SELECT query as described here.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions