I am new to writing functions in PHP, so please don't hate me cause I'm new. I have a function that I am calling in part of my code that has ADOdb code written in it to do database searches based on values passed to the function.
Here is my delema, I think that the function is running the ADOdb stuff prior to the function being called and thus my database search is not working. All other parts of the function work, but the ADOdb part seems to have already run before the function was called.
I know this is confusing but I guess my question is, can you make database calls inside of a function that execute after the function has been called? Not before?
ADOdb code inside of a function
Moderator: General Moderators
- Johnm
- Forum Contributor
- Posts: 344
- Joined: Mon May 13, 2002 12:05 pm
- Location: Michigan, USA
- Contact:
Sure, first, set a flag in the function to see when it is getting called.
Something like this will show you when it is being executed.
Make this the fist line in your function.
John M
Something like this will show you when it is being executed.
Code: Select all
die("Now the function is being executed");John M
Johnm,
Thanks for the comments, but I think I am not stating my issue correctly. Here is the short of it.
When the function runs the first time, prior to the function actually being called, the MySQL code has already ran. Then when I call the function later on in the code it seems that the MySQL code doesn't refresh with the new data, but stays with its original values upon inclusion.
I really appoligize if I am not making this as clear as it is to me. I am finding it hard to simplify my issue into words.
Thanks for the comments, but I think I am not stating my issue correctly. Here is the short of it.
When the function runs the first time, prior to the function actually being called, the MySQL code has already ran. Then when I call the function later on in the code it seems that the MySQL code doesn't refresh with the new data, but stays with its original values upon inclusion.
I really appoligize if I am not making this as clear as it is to me. I am finding it hard to simplify my issue into words.