I'm sure this is a fairly simple question, but I can' figure it out.

I want to be able to run a function and after it has run, pass the variables out of the funtion to be used with in the rest of the PHP program. I'm assuming that while works just like any other function.

More specifically, I am using if and while to check on data in a MySQL database. If the data in the query in one column is 0 then it runs the while funtion. The while function checks the next row until it finds a row that is not 0 in that column. This row id then needs to be passed out side of while and if to the rest of the program.