#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.... so this is what i *still* have...

    <?php
    // connect to the db duh
    $db = mysql_connect("localhost", "user", "pass");
    mysql_select_db("table",$db);
    // select and arrange the data by the datetime row latest first etc
    $result = mysql_query("select * from body order by date desc");
    // insert the table parameters
    echo "<table border=0 cellpadding=0 cellspacing=10 width=475 height=473 bgcolor=#333399>n";
    // get the date column, which is (i presume) a datetime type column
    $thedatetime = mysql_result($result,0,"date");
    // call the function
    changeFormat($thedatetime);
    // now the function itself
    function changeFormat($fromQuery) {
    // let's split first by spaces
    $splitDateTime = explode(" ",$fromQuery);
    // and now $splitDateTime is an array which $splitDateTime[0] is the date and $splitDateTime[1] is the time..
    // let's split these again
    $DateElements = explode("-",$splitDateTime[0]);
    $TimeElements = explode(":",$splitDateTime[1]);
    // Now we format it now that its been split up
    $ReturnVar = '<b>'.$DateElements[1].'.'.$DateElements[2].'.'.$DateElements[0].'</b> '.$TimeElements[0].':'.$TimeElements[1];
    // now the row for the date/time/comment
    echo "<tr bgcolor=#333366><td>n";
    // this is where it breaks how the hell do i fix it?
    echo $ReturnVar;
    // return($ReturnVar);
    }
    while ($myrow = mysql_fetch_row($result)) {
    changeFormat($myrow[0]);
    printf(" <font size=-2>%s</font></td></tr><tr><td valign=top>%s</td></tr>n", $myrow[1], $myrow[2]);
    }

    echo "</table>n";

    if you go look at http://www.likwid.org/test/multiplepulldata.php3 you will see the table etc. w/ dates times a comment next to those... then below the body of the post
    now
    the 7.25.00 post only has the DATE AND TIME and in the table it indeed HAS data for the other fields because i've checked it many many times now... plz plz plz someone tell me what the hell is wrong here before i lose my mind
    thank you

  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2000
    Posts
    669
    Rep Power
    15
    I think what is happening is you are trying to call your date function before you declare it, tyr moving the function just above the first place where you call it.
  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'm not sure which function you're meaning...
    it all *seems* to be ordered correctly as it does dump from the 2nd post on correctly... i figured it had something to do w/ calling echo $ReturnVar and the rest of it on....

    i wish i knew :

  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2000
    Posts
    669
    Rep Power
    15
    See the following code:
    changeFormat($thedatetime);
    // now the function itself
    function changeFormat($fromQuery) {

    You are calling the function changeFormat before you are declaring it. Try calling changeFormat($thedatetime); after you declare the function
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Boston MA USA
    Posts
    23
    Rep Power
    0
    thanks man
    that made much more sense
    and now
    it works! woo!

IMN logo majestic logo threadwatch logo seochat tools logo