Tuesday, February 2, 2010

Organise Code Php Php Code, Retrieving Database Information. How To Organise It?

Php code, retrieving database information. How to organise it? - organise code php

I use a PHP code to be accessed, the contents of the database.

It works, I am impressed with myself:)

However, I do not know how to tell the database to display only 8 items on a page. Top 4 in the row and 4 in the background.

Next 8 results should be on a different page.

Can someone help how to proceed.
Thank you very much,
Tom.

3 comments:

  1. George GarchagudashviliFebruary 2, 2010 at 11:45 PM

    Ok first thing to count the number of rows in your database,
    For example, we have the people in the database and want the people with the name "George show"
    first consultation to be done
    SELECT count (people) of the Person WHERE FirstName = 'George';
    say we have the following result: 27
    Evry in the page you want to view 8 results than
    $ Page = ABS ($ _GET [ 'pageid']) * 8;
    / / What is there to do transactions over $ var page to make it perfect if you have any questions, just say ...
    Following:
    $ Sql = "SELECT name, where people FirstName = 'LIMIT George' $ page 8";
    $ Mysql = mysql_query ($ query);
    and you must save the result in the matrix 8
    while ($ data = mysql_fetch_array ($ mysql))
    (
    $ Name [] = $ data [ 'firstname'];
    )

    and finally, at the top of the page view 4 results
    for ($ i = 0, $ i \\ \\ \\ \\ \\ \\ \\ \\ u0026lt, 4, $ i + +)
    (
    echo $ names [$ i];
    )

    responsible

    for ($ i = 4, $ i \\ \\ \\ \\ \\ \\ \\ \\ u0026lt, 8, $ i + +)
    (
    echo $ names [$ i];
    )

    I hope this helped

    ReplyDelete
  2. George GarchagudashviliFebruary 2, 2010 at 11:45 PM

    Ok first thing to count the number of rows in your database,
    For example, we have the people in the database and want the people with the name "George show"
    first consultation to be done
    SELECT count (people) of the Person WHERE FirstName = 'George';
    say we have the following result: 27
    Evry in the page you want to view 8 results than
    $ Page = ABS ($ _GET [ 'pageid']) * 8;
    / / What is there to do transactions over $ var page to make it perfect if you have any questions, just say ...
    Following:
    $ Sql = "SELECT name, where people FirstName = 'LIMIT George' $ page 8";
    $ Mysql = mysql_query ($ query);
    and you must save the result in the matrix 8
    while ($ data = mysql_fetch_array ($ mysql))
    (
    $ Name [] = $ data [ 'firstname'];
    )

    and finally, at the top of the page view 4 results
    for ($ i = 0, $ i \\ \\ \\ \\ \\ \\ \\ \\ u0026lt, 4, $ i + +)
    (
    echo $ names [$ i];
    )

    responsible

    for ($ i = 4, $ i \\ \\ \\ \\ \\ \\ \\ \\ u0026lt, 8, $ i + +)
    (
    echo $ names [$ i];
    )

    I hope this helped

    ReplyDelete
  3. Here

    http://www.php-mysql-tutorial.com/wikis/ ...

    ReplyDelete