Error connecting to database. [SQL]
#1

Hi,
I have been using a UCP for SA:MP which involves a news.php and several other files which require a mySQL database details to be entered. These files worked before with the exact same host I am using now, I have been in touch with the host and they said that everything is fine on their end and they confirmed that the details I was entering are correct. The following is just one of the files that is causing a problem(any file which involves connecting to database has the exact same error message apart from the location and file name of course)

Error:
Код:
Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'X' (4) in /home/XXXXX/public_html/samp/news.php on line 2
Error connecting to database!
File:
Код:
<?php
$con = mysql_connect("X","XX","XXX");
if(!$con) die("Error connecting to database!");
$con = mysql_select_db("XXXX");
if(!$con) die("Error selecting database!");
$string = "SELECT * FROM `news` ORDER BY `ID` DESC";
$result = mysql_query($string); 
if(!$result)
{
	echo "Error reading news from MYSQL!";
	exit;
}
echo '<center><table width="80%"><tr><td>';
while($news = mysql_fetch_array($result,MYSQL_ASSOC))
{ 
   echo '<center><br><br><br><span style="color:white"><strong><font size="5">'.$news['Title'].'</font></strong><br><br>'.$news['Text'].'</span></center><span style="color:white"><br><p align="right"><i>by '.$news['Admin'].' at '.$news['Time'].'</i></p></span><br>'; 
} 
	echo "</td></tr></table></center>";
?>
Note: XXX = Information which I have hidden.
Note: The problem is definetely in the file as I tried the same file on a different SQL database on a different host, same problem
Note: The SA:MP server can connect to the SQL database just fine, this web server files is the only issue.
Reply


Messages In This Thread
Error connecting to database. [SQL] - by FShiwani - 01.11.2013, 17:34
Re: Error connecting to database. [SQL] - by iJumbo - 01.11.2013, 18:53
Re: Error connecting to database. [SQL] - by FShiwani - 01.11.2013, 21:11
Re: Error connecting to database. [SQL] - by iJumbo - 01.11.2013, 21:52
Re: Error connecting to database. [SQL] - by FShiwani - 01.11.2013, 22:09
Re: Error connecting to database. [SQL] - by iJumbo - 02.11.2013, 02:38
Re: Error connecting to database. [SQL] - by FShiwani - 02.11.2013, 13:00
Re: Error connecting to database. [SQL] - by FShiwani - 04.11.2013, 21:37

Forum Jump:


Users browsing this thread: 1 Guest(s)