Skip to content
Advertisement

DO while based on query result

I got a block of the code written in PHP it uses a DB connection to an Oracle DB, i need to run a query on a data and the result for the first query it should be an input of the next query and this should be inside a loop, if i don’t got any more result from the next query i should exit the loop, at the moment i am using and integer to loop through max 5 times as i know this the maximum possible results received, but this is dynamic.

My actual code what is working is the following:

this is the form when i input the data

php code where i verify data and use function to execute query on DB while i am running a loop.

i don’t want to use a static solution like while ($x <=5)

Any idea how to fulfill this in a different way?

Advertisement

Answer

Should do the trick. So if the next $arr is empty it will exit the loop.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement