Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: function error, NEED help !

  1. #11
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Code:
    $timeDiff($timet,$time);
    Replace with
    Code:
    timeDiff($timet,$time);
    Paste the whole function please.
    Jeremy | jfein.net

  2. #12
    Join Date
    Aug 2009
    Posts
    399
    Thanks
    42
    Thanked 4 Times in 4 Posts

    Default

    nothing changed

  3. #13
    Join Date
    Aug 2009
    Posts
    399
    Thanks
    42
    Thanked 4 Times in 4 Posts

    Default

    maybe function must be written differently?

  4. #14
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Quote Originally Posted by Nile View Post
    [code]

    Paste the whole function please.
    ^^ Read the whole post
    Jeremy | jfein.net

  5. #15
    Join Date
    Aug 2009
    Posts
    399
    Thanks
    42
    Thanked 4 Times in 4 Posts

    Default

    PHP Code:
    <?php 
    include('db_conn.php');
    $queryget mysql_query("SELECT * FROM reg_users ORDER BY `time` LIMIT 10") or die("Error with query");
    while (
    $row mysql_fetch_array($queryget)) 

        
    $nick $row['Nick'];    
        
    $time $row['time'];
        
    $timet date("H:i:s");
        function 
    timeDiff($firstTime,$lastTime)
    {
    $firstTime=strtotime($firstTime);
    $lastTime=strtotime($lastTime);
    $timeDiff=$lastTime-$firstTime;
    return 
    $timeDiff;
    timeDiff($timet,$time);
    }    
    if (
    timeDiff($timet,$time)) {
        echo 
    "
        <table width='200px';>     
            <tr>
            <td align='center';>
            <font size='0.8' face='Verdana' color='blue'><b>
            
    $nick&nbsp;
            </b></font>
            </td>
            </tr>
        </table><br>
        "

    } else {    }}  

    ?>

  6. #16
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Like I said before, move the function outside of the while loop like so:

    Code:
    <?php 
    include('db_conn.php');
    $queryget = mysql_query("SELECT * FROM reg_users ORDER BY `time` LIMIT 10") or die("Error with query");
    
    function timeDiff($firstTime,$lastTime) {
     $firstTime=strtotime($firstTime);
     $lastTime=strtotime($lastTime);
     $timeDiff=$lastTime-$firstTime;
     return $timeDiff;
    }  
    
    while ($row = mysql_fetch_array($queryget)) 
    { 
        $nick = $row['Nick'];    
        $time = $row['time'];
        $timet = date("H:i:s");
      
    if (timeDiff($timet,$time)) {
        echo "
        <table width='200px';>     
            <tr>
            <td align='center';>
            <font size='0.8' face='Verdana' color='blue'><b>
            $nick&nbsp;
            </b></font>
            </td>
            </tr>
        </table><br>
        "; 
    } else {    }}  
    
    ?>
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  7. The Following User Says Thank You to thetestingsite For This Useful Post:

    auriaks (11-12-2009)

  8. #17
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Wow... Sorry -.- I missed the function in the first post... My fault completely.

    Quote Originally Posted by thetestingsite View Post
    move your function outside of the while loop.

    Hope this helps.
    Jeremy | jfein.net

  9. #18
    Join Date
    Aug 2009
    Posts
    399
    Thanks
    42
    Thanked 4 Times in 4 Posts

    Default

    youre the man !! thanks both of you guys, really

  10. #19
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Haha, it wasn't me... 0.o TheTestingSite really did it.
    Please set your post to resolved by editing your first post, and changing the suffix. Good luck.
    Jeremy | jfein.net

  11. #20
    Join Date
    Aug 2009
    Posts
    399
    Thanks
    42
    Thanked 4 Times in 4 Posts

    Default

    ok

Bookmarks

Posting Permissions

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