473,326 Members | 2,805 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Re: Please Help Troubleshoot My First Real Function

Mo <Me***********@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=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
Jun 27 '08 #1
3 1094
Mo
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=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
Jun 27 '08 #2
Une Bévue <un************@weltanschauung.com.invalidwrote:
$fReturn = "Query Error:" . $fError . "<br/>";
OOPS ! put a print here ;-)
--
Une Bévue
Jun 27 '08 #3
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=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.]
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_assoc()
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
Jun 28 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

35
by: wired | last post by:
Hi, I've just taught myself C++, so I haven't learnt much about style or the like from any single source, and I'm quite styleless as a result. But at the same time, I really want nice code and I...
1
by: Az Tech | last post by:
Hi people, (Sorry for the somewhat long post). I request some of the people on this group who have good experience using object-orientation in the field, to please give some good ideas for...
3
by: Jane Withnolastname | last post by:
I sent the following message to my ISP, which provides free webspace: I am using server-side includes on my webspace, but your server does not recognize index.shtml as the main page. Since your...
4
by: Joseph | last post by:
The idea is to show only one of the <Baby_Div> while hiding all the others. At the moment all I have managed to do is to show each <Baby_Div> in turn as expected, but the problem is that once a...
39
by: gtippery | last post by:
Newbie-ish questions - I've been away from C for a _long_ time. It seems to me that there ought to be easier (or at least shorter) ways to do what this does. It does compile & run for me (with...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
7
by: dtschoepe | last post by:
Hi, I am working on a project for school and I am trying to get my head around something weird. I have a function setup which is used to get an input from stdin and a piece of memory is created...
112
by: Prisoner at War | last post by:
Friends, your opinions and advice, please: I have a very simple JavaScript image-swap which works on my end but when uploaded to my host at http://buildit.sitesell.com/sunnyside.html does not...
2
by: kj | last post by:
Hi! I have a Pythonoob question. I have a script that hangs indefinitely at random times; the only thing to do at this point is to kill it. I'm looking for suggestions on how to troubleshoot...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.