Jump to content


Photo

php functions with mysql queries


  • Please log in to reply
No replies to this topic

#1 xfezz

xfezz
  • Members
  • PipPipPip
  • Advanced Member
  • 40 posts

Posted 29 October 2006 - 03:50 AM

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? 








0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users