Re: Please Help Troubleshoot My First Real Function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?ISO-8859-1?Q?Une_B=E9v?==?ISO-8859-1?Q?ue?=

    Re: Please Help Troubleshoot My First Real Function

    Mo <Mehile.Orloff@ gmail.comwrote:
    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=qryFun c($select, $from);
    while ($empRow = mysql_fetch_arr ay($reponse,MYS QL_ASSOC))
    // or mysql_fetch_ass oc($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
  • Mo

    #2
    Re: Please Help Troubleshoot My First Real Function

    On Jun 27, 9:27 am, unbewusst.s...@ weltanschauung. com.invalid (Une
    Bévue) wrote:
    Mo <Mehile.Orl...@ gmail.comwrote:
    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=qryFun c($select, $from);
    while ($empRow = mysql_fetch_arr ay($reponse,MYS QL_ASSOC))
    // or mysql_fetch_ass oc($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_ass oc()
    back into my function (so it doesn't have to be on my page),
    ***PLEASE*** advise.

    Thanks-a-bunch,
    Mo

    Comment

    • =?ISO-8859-1?Q?Une_B=E9v?==?ISO-8859-1?Q?ue?=

      #3
      Re: Please Help Troubleshoot My First Real Function

      Une Bévue <unbewusst.sein @weltanschauung .com.invalidwro te:
      $fReturn = "Query Error:" . $fError . "<br/>";
      OOPS ! put a print here ;-)
      --
      Une Bévue

      Comment

      • Peter H. Coffin

        #4
        Re: Please Help Troubleshoot My First Real Function

        On Fri, 27 Jun 2008 10:30:03 -0700 (PDT), Mo wrote:
        On Jun 27, 9:27 am, unbewusst.s...@ weltanschauung. com.invalid (Une
        Bévue) wrote:
        >Mo <Mehile.Orl...@ gmail.comwrote:
        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=qryFu nc($select, $from);
        >while ($empRow = mysql_fetch_arr ay($reponse,MYS QL_ASSOC))
        >// or mysql_fetch_ass oc($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.]
        No, I'm mostly advising scrapping the function entirely, or if you want
        to keep something in a function, put your output generation in it, then
        call it from WITHIN your loop. Your query can NEVER be inside the loop
        you're using to read that query's results, see... You can do OTHER
        queries inside there, but not THAT one.
        >
        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_ass oc()
        back into my function (so it doesn't have to be on my page),
        ***PLEASE*** advise.
        Streamline later. Go back to a working example first.

        --
        25. No matter how well it would perform, I will never construct any sort of
        machinery which is completely indestructible except for one small and
        virtually inaccessible vulnerable spot.
        --Peter Anspach's list of things to do as an Evil Overlord

        Comment

        Working...