Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 3 of 3

Thread: Functions

  1. #1
    Join Date
    Mar 2009
    Location
    Western Australia
    Posts
    386
    Tokens
    0

    Default Functions

    Getting this error:
    Code:
    Fatal error: Cannot redeclare xx_mysql_connect() (previously declared in C:\xampp\htdocs\TheEnd004500\xlogin\xxz\xx_config.php:10) in C:\xampp\htdocs\TheEnd004500\xlogin\xxz\xx_config.php on line 12
    PHP Code:
    <?php
    /************************************************************
    This file contains all used custom functions
    ************************************************************/

    //Functions

    function xx_mysql_connect() 
    {
     
    $conn mysql_connect('localhost','root','123') or die('<b>Error! </b>' mysql_error());
     
    mysql_select_db('theend004500') or die('<b>Error! </b>' mysql_error());
    }


    function 
    xx_select_page($title)
    {
    $querypage mysql_query("SELECT * FROM `pages` WHERE `title`='$title'");
    while (
    $row mysql_fetch_assoc($querypage))
    {
    echo 
    $row['body'];
    }
    }

    function 
    xx_new_message()
    {
       
    $conn mysql_connect('removed','removed,'removed') or die('<b>Error! </b>' . mysql_error());
     mysql_select_db('
    removed') or die('<b>Error! </b>' . mysql_error());
    $messages_new = mysql_query("SELECT * FROM `messages` WHERE `to`='
    1'");
    $numrows = mysql_num_rows($messages_new);

    if ($numrows>0)
    {
    echo "<div align='
    center' id='messagenew'>You have a new message!</div>";
    }
    }

    ?>

  2. #2
    Join Date
    Nov 2006
    Location
    Narrich
    Posts
    5,687
    Tokens
    0
    Habbo
    Jamesy...

    Latest Awards:

    Default

    By the looks of the error message you've already declared this function in your config.php

    PHP Code:
    function xx_mysql_connect()  

     
    $conn mysql_connect('localhost','root','123') or die('<b>Error! </b>' mysql_error()); 
     
    mysql_select_db('theend004500') or die('<b>Error! </b>' mysql_error()); 

    What's the config.php code?
    Ex-janitor. Might pop in from time to time, otherwise you can grab all my information from http://jamesy.me.uk/

  3. #3
    Join Date
    Mar 2009
    Location
    Western Australia
    Posts
    386
    Tokens
    0

    Default

    Oh I added the $conn into the xx_new_message() to try and see if it would help.. forgot to remove.. what do you mean what's the config.php code? that's the config php code.

Posting Permissions

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