Jump to content


This topic is now archived and is closed to further replies.


php functions with mysql queries

Recommended Posts

I'll try to keep this as simple as possible. This is a two part question.

Part 1:
I have no clue how to use php functions with mysql queries. How to pass different variables and different clauses to the database.. ect.  I have been trying to find some kind of tutorials on this but I haven't had any luck. 

Part 2:
I found an open source pagination function that i'm trying to incorporate it to my mysql query. I was talking to one of my online buddies and he also mentioned about writing a function (with the pagination code) and have that function as an php include. Then just call the function whenever it's needed. Sounds simple when you know what you are doing.

For example. Say you have a function as follows:
function genPagination($total,$currentPage,$baseLink,$nextPrev=true,$limit=10)

some pagination code here ect.. ect..

And this function is contained in pagination.php.  I presume I would load this as an include on a separate page example, (admin_article.php) where the output is being displayed and the pagaination is needed.  Then I would  just call the function where I would like the pagination code executed, correct? Could someone point me in the general direction on how I should go about doing this? 

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.