Hey, Is it possible to create a query from a query in PHP. I know you can do this in Cold fusion. Cold fusion Example: <cfquery name="getUser" datasource="DSource"> select * FROM users </cfquery> <!--- Query from a query ---> <cfquery name="getUser" dbtype="query"> select * FROM users where uerid = 256 </cfquery> I'd like to be able to do this in PHP, so if anyone could help me out it would be great, thanks
I am not a performance expert, nor do I know coldfusion, but I am not sure why the extra step is needed... Maybe you could explain what you are trying to do. In any event... you could just sort through the returned array instead of running a 2nd query.
The reason i'd like to do this is because the query i'm running returns a huge number of results and takes a while... By using a query from query I only need to go to the DB once, and then get what i need from the 2nd query. This way the page will load alot faster.
Hey thats exactly what rjb is talking about. You just query the database once and get the results into an array with mysql_fetch_array or mysql_fetch_row, to get rows one at a time. The DB is queried only once and then you only have to process the array. Thomas