Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Display data

  1. #1
    New Coder
    Join Date
    May 2006
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Display data

    Hi..
    My Problem:

    I've one table that have only one field that is entry_num.

    So i would like to display all data from this table...my code is quite simple:
    PHP Code:
    $db->query(sprintf("SELECT * FROM %s "
                            
    "entry_num"));    
               
           
    $i=0;     
           
           while (
    $i <= $db->num_rows()){ 
                
           
    $db->next_record(); 
           
           
    $str .= urlencode(sprintf($db->f("entry_number"))); 
                      
             
    $i++; 
              
             } 
    My biggest problem when i want to display, the data show in one row 123456788 continously...so how to separate the data like 123 456 788...if it could be done ine table please just show what should i add in the coding

  • #2
    Regular Coder
    Join Date
    Nov 2002
    Location
    Manchester, UK
    Posts
    533
    Thanks
    4
    Thanked 1 Time in 1 Post
    what is it you need to show? If it's a gap between the numbers every third one, why not set another increment and put a space...eg

    PHP Code:
    $x 1;
    while (
    $i <= $db->num_rows()){ 
                
           
    $db->next_record(); 
           
           
    $str .= urlencode(sprintf($db->f("entry_number"))); 
           if (
    $x == 3) {
                  echo 
    "&nbsp;"
                  
    $x 1;
           } else {
                  
    $x++;
           } 
             
    $i++; 
              
             } 
    is that what you mean? Sorry if I've misunderstood!!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •