PDA

View Full Version : Functions



Shibby-Shabs
12-11-2010, 08:15 AM
Getting this error:

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
/************************************************** **********
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>";
}
}

?>

Jamesy
12-11-2010, 08:23 AM
By the looks of the error message you've already declared this function in your config.php


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?

Shibby-Shabs
12-11-2010, 11:23 AM
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.

Want to hide these adverts? Register an account for free!