Jump to content

php functions with mysql queries


xfezz

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:
[code]
function genPagination($total,$currentPage,$baseLink,$nextPrev=true,$limit=10)
{

some pagination code here ect.. ect..
[/code]

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? 



Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.