Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2004
    Posts
    2

    Unanswered: Display Retrieved Table Data. Help Appreciated.

    Being new to php i have this standard php script which connects me and reads the requested data . I would like this to be based on latest registration date or ID. How can I display this data and then write it to another table.



    <?php
    $db_link = mysql_connect('localhost', 'uname', 'password');
    mysql_select_db("database",$db_link);

    if ($db_link) {
    echo ' Connection Has been Made: OK.';
    }
    else
    { echo 'Connection Was Not Made .';
    }

    $query = "SELECT `user_id`, `name`, `username`, `user_email`, `user_password` FROM `new_users` WHERE ( its the newest date entry) ";
    $result = mysql_query($query)
    or die("SELECT Error: ".mysql_error());

    if ($result) {
    echo "<br>Your Query Executed successfully.<br>";

    }
    now write it to another table prefix new1_users fields ('íd', úsername', 'password', 'email') allowing login with same details.


    Thanks for any help recieved.

    Cardy

  2. #2
    Join Date
    Sep 2003
    Location
    ZA
    Posts
    24

    Talking Display MySQL Data

    Heh Cardy ,

    Dunno if you've sorted this query out already ....

    I managed to find a method to display the output of the DB.


    $query = mysql_query("select * from DATABASE");

    if (mysql_num_rows($query) == 0) {
    print '<center><p>Sorry, Nothing to Display.</p></center>';
    }
    else{
    while($row = mysql_fetch_array($query)){

    print '<table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td bgcolor="#CCCCFF"><b>DESCRIPTION: </b>' . $row[id] . ' <b>DESCRIPTION</b> ' . $row[id] . '</td>
    </tr>
    <tr>
    <td>' . $row[id] . '</td>
    </tr>
    <tr>
    <td>' . $row[id] . '</td>
    </tr>
    <tr>
    <td>' . $row[id] . '</td>
    </tr>
    </table>';
    }
    }
    ?>


    Hope this helps you out.

    regards
    ./ronald

Posting Permissions

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