Results 1 to 4 of 4

Thread: [RESOLVED] Remove repeating values

Threaded View

  1. #1

    Thread Starter
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Resolved [RESOLVED] Remove repeating values

    Hi,

    I am trying to display data to the screen using the following code:

    PHP Code:
    <?php

    $db_host 
    "localhost";

    $db_name "students";

    $db_user "root";

    $db_pass "";

    $table "students";

     
    mysql_connect($db_host,$db_user,$db_pass);
    mysql_select_db($db_name) or die("Unable to select database.");

        
    $data mysql_query("SELECT * FROM $table");

    $info mysql_fetch_array($data);
    while(
    $info mysql_fetch_array$data )){

    $comma_separated implode(","$info);

    print 
    $comma_separated;
    }
    ?>
    It works! However, I get a double up of the values like so:

    2 2 Mike Mike 17 17 Male Male 05/06/1990 05/06/19903 3 Joann Joann 17 17 Female Female 26/06/1982 26/06/19824 4 Rachel Rachel 14 14 Female Female 23/07/1980 23/07/19805 5 Robert Robert 13 13 Male Male 23/06/1990 23/06/19906 6 Sarah Sarah 14 14 Female Female 21/4/1990 21/4/19907 7 evan evan e e e e e e8 8 fiona fiona f f f f f f
    I checked over my code to see what might be causing the problem but I can't find it.

    Thanks,


    Nightwalker
    Last edited by Nightwalker83; Dec 31st, 2009 at 08:52 PM. Reason: Fixed spelling
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

Posting Permissions

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



Click Here to Expand Forum to Full Width