php/mysql echoing same thing twice--help!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • TheKeith

    php/mysql echoing same thing twice--help!

    I'm just learning php and set up a sample mysql db to practice with. I
    have the following script and cannot for the life of me figure out why
    it is printing each field of the row twice? I checked my db and it only
    contains the entries once. What is causing this?!

    -----------------------------------------------------------------------
    <?php
    $con_id = mysql_connect(' localhost','dbo ard_mbr','pa1ss 2wo3rd');

    mysql_select_db ('kp_dboard',$c on_id);

    echo join(mysql_fetc h_array($theque ry=mysql_query( 'select * from
    threads',$con_i d)),' --- ') . '<br>';

    echo join(mysql_fetc h_array($theque ry),' --- ') . '<br>';

    echo join(mysql_fetc h_array($theque ry),' --- ');
    ?>
    -----------------------------------------------------------------------

    Help would be appreciated--thanks.

    Keith
  • TheKeith

    #2
    Re: php/mysql echoing same thing twice--help!

    TheKeith wrote:
    [color=blue]
    > I'm just learning php and set up a sample mysql db to practice with. I
    > have the following script and cannot for the life of me figure out why
    > it is printing each field of the row twice? I checked my db and it only
    > contains the entries once. What is causing this?!
    >
    > -----------------------------------------------------------------------
    > <?php
    > $con_id = mysql_connect(' localhost','dbo ard_mbr','pa1ss 2wo3rd');
    >
    > mysql_select_db ('kp_dboard',$c on_id);
    >
    > echo join(mysql_fetc h_array($theque ry=mysql_query( 'select * from
    > threads',$con_i d)),' --- ') . '<br>';
    >
    > echo join(mysql_fetc h_array($theque ry),' --- ') . '<br>';
    >
    > echo join(mysql_fetc h_array($theque ry),' --- ');
    > ?>
    > -----------------------------------------------------------------------
    >
    > Help would be appreciated--thanks.
    >
    > Keith[/color]


    oh by the way I only entered the echo statement 3 times because there
    are 3 records in the db. I should have taken out two of them for the
    example.

    Comment

    • TheKeith

      #3
      Re: php/mysql echoing same thing twice--help!

      TheKeith wrote:[color=blue]
      > I'm just learning php and set up a sample mysql db to practice with. I
      > have the following script and cannot for the life of me figure out why
      > it is printing each field of the row twice? I checked my db and it only
      > contains the entries once. What is causing this?!
      >
      > -----------------------------------------------------------------------
      > <?php
      > $con_id = mysql_connect(' localhost','dbo ard_mbr','pa1ss 2wo3rd');
      >
      > mysql_select_db ('kp_dboard',$c on_id);
      >
      > echo join(mysql_fetc h_array($theque ry=mysql_query( 'select * from
      > threads',$con_i d)),' --- ') . '<br>';
      >
      > echo join(mysql_fetc h_array($theque ry),' --- ') . '<br>';
      >
      > echo join(mysql_fetc h_array($theque ry),' --- ');
      > ?>
      > -----------------------------------------------------------------------
      >
      > Help would be appreciated--thanks.
      >
      > Keith[/color]


      nevermind--I got it. You're supposed to indicate whether you want an
      array with numeric indeces or associative indices, otherwise it returns
      both--doubling all fields.

      Comment

      Working...