#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Boston MA USA
    Posts
    23
    Rep Power
    0
    Ok.... I admit im a newbie to this all
    but
    A: how do i force when i pull data to a table the text to wrap?
    and
    B: how do i control order of how it is displayed when it draws from the DB? (ie 07/25/00 11:45pm showing up at the top then 07/25/00 9:45am showing up after that)
    what i have right now:
    <?php
    $db = mysql_connect("localhost", "username", "password");
    mysql_select_db("dbname",$db);
    $result = mysql_query("SELECT * FROM body",$db);
    echo "<table border=0 cellpadding=0 cellspacing=10 width=475 height=473 bgcolor=#333399>n";
    while ($myrow = mysql_fetch_row($result)) {
    printf("<tr bgcolor=#333366><td><b>%s</b> %s <font size=-2>%s</font></td></tr><tr><td valign=top>%s</td></tr>n", $myrow[0], $myrow[1], $myrow[2], $myrow[3]);
    }
    echo "</table>n";
    ?>
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    13
    Rep Power
    0
    A: You don't need to force the text to wrap. It will wrap automatically. (Did I miss something here?)

    B: You can order your database search results by "ORDER BY". Say you want order the results by date in descending order, use this mysql query:
    SELECT * FROM body ORDER BY date DESC;
    Here I assume the name of your date field is "date".

    Good luck,
    Jinn


    ------------------
    Stories OnLine
    http://www.stories-online.net/

    WARNING: adult stories!
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Boston MA USA
    Posts
    23
    Rep Power
    0
    i have date *and* time
    so can i tell it to order it by both maybe?

    thnx

  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Boston MA USA
    Posts
    23
    Rep Power
    0
    yet some other thoughts :P
    i have my time in the format in the database as "07.05.00"
    would i have to revert it back to "07/05/00" for it to be understood? or should i switch to 3 fields for it etc.? the time also?

    blah! im lost! hehe

    thnx yet again
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Roseburg, OR, USA
    Posts
    23
    Rep Power
    0
    try adding a TIMESTAMP column to your database. lets say your database was called 'updates' and you named your TIMESTAMP, 'tymestamp'. to arrange a selection showing the most recent entries first you would do something like this:

    $result = mysql_query ("SELECT * FROM updates ORDER BY tymestamp DESC")

    the TIMESTAMP data type starts with year and progresses to seconds. read the mysql manual it does a better job then i will.

    hope this helped : ) .
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Boston MA USA
    Posts
    23
    Rep Power
    0
    so using tymestamp
    it would be and int(12) NOT NULL auto_increment
    ?

    thnx

Similar Threads

  1. Writing to a word file using data from Mysql
    By Liz213 in forum Java Help
    Replies: 5
    Last Post: January 22nd, 2004, 11:38 PM
  2. ADO_ACCESS & complex query
    By largeinnit in forum PHP Development
    Replies: 0
    Last Post: January 1st, 2004, 03:57 PM
  3. Upgrade from access to mysql
    By karib1 in forum ASP Programming
    Replies: 7
    Last Post: December 16th, 2003, 12:35 PM
  4. Upgrade from access to mysql
    By karib1 in forum MySQL Help
    Replies: 1
    Last Post: December 16th, 2003, 12:27 AM

IMN logo majestic logo threadwatch logo seochat tools logo