01.11.2013, 17:34
(
Последний раз редактировалось FShiwani; 01.11.2013 в 18:47.
)
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:
File:
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.
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!
Код:
<?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: 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.