Re: Please Help Troubleshoot My First Real Function



On Jun 27, 9:27 am, unbewusst.s...@xxxxxxxxxxxxxxxxxxxxxxxxxx (Une
Bévue) wrote:
Mo <Mehile.Orl...@xxxxxxxxx> wrote:
while ($empRow = qryFunc($select, $from))
{
print $empRow["name"] . "<BR />";
}

may be the iteration should be inside your function qryFunc ?

or, return $fQuery (when no error)

and then :

$reponse=qryFunc($select, $from);
while ($empRow = mysql_fetch_array($reponse,MYSQL_ASSOC))
// or mysql_fetch_assoc($reponse)
{
print $empRow["name"] . "<BR />";

}

because, as far as i've understood your code, each time u oterate (while
loop) there is a new call to the fucntion "qryFunc" and u use only the
first result giving an infinite loop ???
--
Une Bévue

Thanks for all the help.
Since my ultimate purpose for this function is to get the info for
use, rather than for echo/print, I will just trim down my function to
the point of $fQuery, as suggested by Une Bévue.

[NOTE: Mr. Coffin, as I understand your suggestion, you are advising
me to give the print commands in the function. If I misunderstood,
please correct my thinking. (For my intended purposes, other options
may be more suited.)
As I am a novice, laymen terms and/or code examples are always
welcome.]

My goal is to streamline my code as much as possible, so if anyone has
any further suggestions on how to get the
mysql_fetch_assoc()
back into my function (so it doesn't have to be on my page),
***PLEASE*** advise.

Thanks-a-bunch,
Mo
.



Relevant Pages