#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    9
    Rep Power
    0

    I wish to need help on pdo


    i wish to display the results of dis quarry the results are from one to 100 and i wish to display the m in 4 different div each each 25
    and i wish to run the query only one time could some one help me these are my codes.
    <!--This is the content-->
    <?php
    $i=1;
    echo " <table width='600' border='0'>";

    try {
    $pdo_options[PDO::ATTR_ERRMODE]=PDO::ERRMODE_EXCEPTION ;
    $Dbc= new PDO('mysql:host=localhost;dbname=gths','fruanthony','admin',$pdo_options);
    $register_user=$Dbc->query("SELECT id,name, department from staff WHERE id <20");
    echo "<ul>";
    while($results = $register_user->fetch())
    {
    echo "<center>";
    echo "<li>".$results['name']." ".$results['department']."</li>";
    echo "</center>";
    }
    }
    // echo "Your Detials have been added to the data base";

    catch(Exception $e)
    {die ('ERROR: '.$e->getMessage());
    exit;
    }
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,464
    Rep Power
    594
    Not sure what you are really asking but where is your code? See the sticky at the top of this forum.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  4. #3
  5. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Hi,

    make a for loop (starting a 1), and whenever the index is divisible by 25 and doesn't equal 100, you append a "</div><div>".

    Of course you can also check explicitly for the index 25, 50 and 75.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    9
    Rep Power
    0
    Originally Posted by Jacques1
    Hi,

    make a for loop (starting a 1), and whenever the index is divisible by 25 and doesn't equal 100, you append a "</div><div>".

    Of course you can also check explicitly for the index 25, 50 and 75.

    thanks that was of great help

IMN logo majestic logo threadwatch logo seochat tools logo