|
Tosbi (m)
|
Dear fellow Great web designers, I am working on a web project that will require membership where members can search for fellow members in the site. Although, i have no problem with the code for creating such. But where i am confused is the area of breaking pages. I will like you guys to help me out with the PHP CODE for breaking result pages such that, when you search for members on the site, the page should be able to display 10 rows of result and enable you navigate through the rest of the result. An example is when you search on google, the search result page brings only top 10 rows with links to other pages within the searched result because all the results cannot be displayed on only a page. I am sure you guys understand what i mean. Thanks 
|
|
|
|
|
|
Cactus (m)
|
Google - PAGINATION
Search and read u will have a better understanding than someone providing you with the code
|
|
|
|
|
|
kazey (m)
|
This is actually very easy, and since you mention that you already have php and mysql coding skills , I am going to give you tips. Here I am assuming you know how to write your mysql queries and how to understand written code. The search.php is assumed the file, you can change the name. Feel free to ask any question. //Add your mysql query , $result = @mysql_query ($query); $row = mysql_fetch_array ($result, MYSQL_NUM); $num_records = $row[0];
// Number of records to show per page: $display = 10;
// Calculate the number of pages. if ($num_records > $display) { // More than 1 page. $num_pages = ceil ($num_records/$display); } else { $num_pages = 1; }
// Make the links to other pages, if necessary. if ($num_pages > 1) { echo '<br /><p>'; // Determine what page the script is on. $current_page = ($start/$display) + 1; // If it's not the first page, make a Previous button. if ($current_page != 1) { echo '<a href="search.php?s=' . ($start - $display) . '&np=' . $num_pages . '&sort=' . $sort .'">Previous</a> '; } // Make all the numbered pages. for ($i = 1; $i <= $num_pages; $i++) { if ($i != $current_page) { echo '<a href="search.php?s=' . (($display * ($i - 1))) . '&np=' . $num_pages . '&sort=' . $sort .'">' . $i . '</a> '; } else { echo $i . ' '; } } // If it's not the last page, make a Next button. if ($current_page != $num_pages) { echo '<a href="search.php?s=' . ($start + $display) . '&np=' . $num_pages . '&sort=' . $sort .'">Next</a>'; } Looking for a host to host your PHP AND MYSQL Websites? Visit Nairahost Nigeria Now
|
|
|
|
|
|
nduaj (m)
|
hi, i just ran through the code above, nice one, it should work properly on ur project , just customise it to ur site
|
|
|
|
|
|
rufaai (m)
|
WOW!  Kayzey got it all, I never thought of coding something like that, Its greate! - I also got a copy for my self. PHP is HOT!
|
|
|
|
|
|
|
|
Afam (m)
|
WOW!  Kayzey got it all, I never thought of coding something like that, Its greate! - I also got a copy for my self. PHP is HOT! No wonder over 70% of dynamic websites in the world run on PHP, never mind people attacking all the time. With PHP there are no limits especially as it relates to the web, which by the way is what it was designed for in the first place.
|
|
|
|
|
|
xanadu
|
No wonder over 70% of dynamic websites in the world run on PHP, never mind people attacking all the time.
With PHP there are no limits especially as it relates to the web, which by the way is what it was designed for in the first place. @Afam, right on! Never mind the people who think PHP is 'lightweight' - the truth is, they do not really know the full powers of PHP. People tend to overlook the fact that it has evolved, over time, into arguably the world's most popular tool for creating dynamic websites.
|
|
|
|
|
|
|
|
mambenanje (m)
|
talking about this No wonder over 70% of dynamic websites in the world run on PHP, never mind people attacking all the time.
With PHP there are no limits especially as it relates to the web, which by the way is what it was designed for in the first place. because php runs 70% web it doesnt mean its good enough for real engineering. try to answer this. Could Sergey Brin and Larry Page build Google with php ?? what of Gmail can you build that with php and have such ease of use, what of google docs and spreadsheeth. Well facebook.com and yahoo.com are php, do you know the difficulties involved in scalling the server farms. php is good for startups because its cheaper to run but in the future you have to change to something more robust like java or C#. So its advisable you know java and C# and even ruby on rails though your coding your stuffs in php. the guys of facebook all know C++ and right now facebook is running on C++ extensions and no more php Hope you get it all, and this is just my own 2 cents so no one should come here and say here I go again talking what I know nothing about
|
|
|
|
|
|
Afam (m)
|
Go out there are learn what you don't understand. Trying to use ill thought out comments to get enlightenment on issues won't get you anywhere.
PHP is for startups. This is the most stupid comment I have read on this forum by someone that thinks he knows.
|
|
|
|
|
|
hanen (f)
|
@mambenanje
this is the second time i've seen you talk absolute jargon about a very simple issue, needless to say I'm worried. I evn have to second Afam.
|
|
|
|
|
|
kazey (m)
|
{quote author=mambenanje link=topic=76867.msg2116311#msg2116311 date=1207166134] talking about this because php runs 70% web it doesnt mean its good enough for real engineering. try to answer this. Could Sergey Brin and Larry Page build Google with php ?? what of Gmail can you build that with php and have such ease of use, what of google docs and spreadsheeth. Well facebook.com and yahoo.com are php, do you know the difficulties involved in scalling the server farms. php is good for startups because its cheaper to run but in the future you have to change to something more robust like java or C#. You don't know what you are talking about, and because of that I wont waste my time explaining the dynamics of programming languages, and how they are used for different purposes etc.
|
|
|
|
|
|
Afam (m)
|
You don't know what you are talking about, and because of that I wont waste my time explaining the dynamics of programming languages, and how they are used for different purposes etc.
Exactly, he wants someone to explain to him and yet he is not humble enough to ask for help. I noticed this sometime ago and stated that he was obviously new to the web. He disagreed, well maybe he spends most of his online time watching porn otherwise someone that claims to know shouldn't even be asking about the meaning of web 2.0 let alone making the ridiculous statements he made on this particular thread on PHP. And to imagine that this clown was offering useless advice on how I should develop a website, nothing wey person no go see for nairaland.
|
|
|
|
|
|
mambenanje (m)
|
though I have better things to do I saw the attacks so I decided to clearify myself. please all the guys thinking I don't know what I was talking about please take some time off and read this and after reading http://www.cmswire.com/cms/industry-news/php-vs-java-vs-ruby-000887.php then we can argue but constructively because I don't have time to arguing destructively. if you read that article very well dated November 2006, you will understand why I said php is good for startups and for big projects people go direct for java and the main advantage is that java supports BIG TEAMS WORKING ON ONE PROJECT TOGETHER. php supports this sparsely unless you go for ruby on rails ports. @Afam I am tired of your talks of me knowing nothing and new on the web. this is my current project www.studentnetworks.in and yes I am in Africa but working on an Indian website. Please try talk less about others you barely know. more to that I am Macromedia Certified since 2005. I don't talk about what I don't know I read articles and add to my skills everyday. I hope next time you wont say I know nothing. and as an advice try to signup for some google alerts for some topics you like it will give you articles to read everyday because you are not soo current. Good Luck
|
|
|
|
|
|
my2cents (m)
|
he heeeeeeeeeeeeeeeee (my laff don dey reach london  )h!! Una never finish this one http://www.nairaland.com/nigeria/topic-115434.0.html and now una wan start another one. In my opinion, the guy who asked for help will end up probably being traumatized and confused by the time this is over. Dude asked for help and instead he has to discern whether or not PHP is used for startups/mature organized, as opposed to the help he needs. Not to mention, if I am not mistaken, this thread was posted some time last year. In the event that it is resurrected, should it be for this? Where is uspry1 when you need her?  he heeeeeeeeeeddddddeeeeeee (my laff don reach london. Now e dey go hamburg  )h!!
|
|
|
|
|
|
Afam (m)
|
And he points us to a website running on PHP, wonders shall never end.
|
|
|
|
|
|
uspry1 (f)
|
@afam and mambenanje PLEASE ACT YOUR AGE ! Stop fighting over which programming (PHP vs Ruby/Java/C#) is the best. The poster asks for help, not what you both talk about this programming. OKAY!This is based on the client who hires the person to do the job providing the specified programming, design layout, and identity the client wants, not you! OKAY!Afam is PHP programmer, not a web designer, dealing with web portal development using PHP. But Mambenanje is certified Flash developer dealing with dynamic website development using Flash Actionscript to incorporate external files such as C#, PHP, XML, etc. Both are different programmers! OKAY! @mambenanje I look at your link: http://www.studentnetworks.in is still incomplete site! However it is nice design work! Two other sites i saw: 2faceidibiafans.com and webyfolio.com are awesome, too! ===== ATTENTION ====== By the way for both of you @Afam and Mambenanje, why don't you help out this poster, @Tosbi to figure out how to incoroporate the pagination on his existing site? Ose gan!!!
|
|
|
|
|
|
Afam (m)
|
ACT MY AGE? For responding to someone that clearly does not have a clue about what he is talking about? Or do you subscribe to people misleading others on this forum. Anyone that posts nonsense should as a matter of urgency be corrected lest people get the wrong impression that the forum is made up of people that know next to nothing. Reminds me of some people in the village that are only happy when other people have problems. Poor style.
|
|
|
|
|
|
mambenanje (m)
|
@Afam thanks for understanding and also proving how good a webmaster you are bye
|
|
|
|
|
|
webdezzi (m)
|
mambenanje, please correct that statement, php is NOT meant for start ups
|
|
|
|
|
|
mambenanje (m)
|
@webdezi if thats what will please you fine, php is not meant for startups. But as a personal advice from my experience I will wish to inform you that if you plan to make a multinational project that wil have servers in AFrica, Europe and Asia please go with something like java, python, C#(asp.net) because its more robust and if you need about 20 guys working on one section of your website, count php out because its having serious issues when it comes to team work. Well this is what I am telling guys from my idea as a web developer with two startups to my profile, but you can take it or leave it
|
|
|
|
|
|
Tosbi (m)
|
Hi guys. thanks alot for all the response so far. It's amazing to see that a topic that is more than a year old is still been delibrated upon. well, i ve actually gotten the needed code thanks to kazey within short days of posting this topic. Once again, i say a big thank you to you guys for your co-operation. Long live Nigerian Webmasters.
|
|
|
|
|
|
Abidemi_A
|
It is good to understand more than one language, you should concentrate more on OOP Language. Although PHP5> supports OOP, you can not compare its level of support with that of C# OR Java.
|
|
|
|
|
|
Abidemi_A
|
@Tosbi ,
You can easily achieve your objective with gridview if you use C#.NET within VS2005 IDE. It will benefit you in future if you start laying your hands on C# now, it is not as difficult as you think, I even consider it simpler than PHP, with little lines of code, you achieve a lot.
Let me have your link when the job is completed.
Happy programming.
|
|
|
|
|
|