SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Thread: plz help me...

  1. #1
    The Jellophonic Autobrain CHeeSeBLiND's Avatar
    Join Date
    Jul 2001
    Location
    Bolton, England
    Posts
    584
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    plz help me...

    PHP Code:
    <?PHP // functions.php

    // variables

    $dbhost "localhost";
    $dbuser "";
    $dbpass "";


    // dbConnect()

    function dbConnect($db="") {    
        global 
    $dbhost$dbuser$dbpass;        

    $dbcnx = @mysql_connect($dbhost$dbuser$dbpass)        
        or die(
    "The site database appears to be down.");

    if (
    $db!="" and !@mysql_select_db($db))        
        die(
    "The site database is unavailable.");        

    return 
    $dbcnx;

    }


    // error()

    function error($msg) {    
        
    ?>    
        <html>    
        <head>    
        <script language="JavaScript">    
        <!--        
        alert("<?=$msg?>");        
        history.back();    
        //-->    
        </script>    
        </head>    
        <body>    
        </body>    
        </html>    
        <?    
        
    exit;
    }


    // header()

    function header($title) {

    echo (
    "
        <html>
        <head>
        <title>[.Ph&yuml;sm's Journal.] - 
    $title</title>
        <meta http-equiv=Content-Type content=text/html; charset=iso-8859-1>
        <link rel=stylesheet href=style.css type=text/css>
        </head>

        <body bgcolor=#0099CC text=#000000>
        <div align=center>
         <table width=500 border=1 cellspacing=0 cellpadding=3 bordercolor=#000000>
            <tr> 
              <td bgcolor=#000000> 
            <div align=center><font color=#FFFFFF>Ph&yuml;sm's Journal - 
    $title</font></div>
              </td>
            </tr>
            <tr> 
              <td bgcolor=#FFFFFF>
            <div align=center><a href=index.php>Entries</a> | Me | Calender 
              | Friends | Links</div>
              </td>
            </tr>
          </table>
          <br>
    "
    );

    }


    // pagecount()

    function pagecount($page,$date) {

    $result mysql_query("SELECT count FROM count WHERE page='$page'");
    while ( 
    $row mysql_fetch_array($result) ) { 

    $count $row[count] + 1;

    $sql "UPDATE count SET count='$count' WHERE page='$page'";

    echo (
    "This page has been viewed $count times since $date.");

    }


    // footer()

    function footer($page,$date) {

    echo (
    "
        <table width=500 border=1 cellspacing=0 cellpadding=3 bordercolor=#000000>
            <tr> 
              <td bgcolor=#000000> 
            <div align=center><font color=#FFFFFF>Details</font></div>
              </td>
            </tr>
            <tr> 
              <td bgcolor=#FFFFFF> 
            <div align=center>pagecount(
    $page,$date);</div>
              </td>
            </tr>
          </table>
          <a href=http://www.cheeseblind.f2s.com>&copy;2001 CHeeSeBLiND WeBDeSiGN</a></div>
        </body>
        </html>
    "
    );

    }

    ?>
    i keep getting this error:

    Parse error: parse error in c:\phpdev\www\public\v2\functions.php on line 122
    The site database is unavailable.


    line 122 is the line just after the last closing ?>
    hmm...

  2. #2
    Happy Holidays !! Paul S's Avatar
    Join Date
    Mar 2001
    Location
    Mexico
    Posts
    1,287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    [edit] Forget what I said
    Last edited by Paul S; Nov 14, 2001 at 14:02.

  3. #3
    The Jellophonic Autobrain CHeeSeBLiND's Avatar
    Join Date
    Jul 2001
    Location
    Bolton, England
    Posts
    584
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thx but im still getting the same error.

    im guessing ive missed a closing bracket or something but i cant spot it.
    hmm...

  4. #4
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The function below is missing a closing bracket "}" plus you need mysql_query for UPDATE.
    PHP Code:
    // pagecount()

    function pagecount($page,$date) {

    $result mysql_query("SELECT count FROM count WHERE page='$page'");
    while ( 
    $row mysql_fetch_array($result) ) { 

    $count $row[count] + 1;

    $sql "UPDATE count SET count='$count' WHERE page='$page'";

    echo (
    "This page has been viewed $count times since $date.");



  5. #5
    The Jellophonic Autobrain CHeeSeBLiND's Avatar
    Join Date
    Jul 2001
    Location
    Bolton, England
    Posts
    584
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thx alot, that worked

    but i keep getting this error know (sorry for all these but im still learning)

    Fatal error: Cannot redeclare header() in c:\phpdev\www\public\v2\functions.php on line 49
    hmm...

  6. #6
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you locate line 49?

  7. #7
    The Jellophonic Autobrain CHeeSeBLiND's Avatar
    Join Date
    Jul 2001
    Location
    Bolton, England
    Posts
    584
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ah nvm figured it now (duh!)
    hmm...


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
  •