Access denied and mysql gone away

Hi, I have this message on the browser:

Invalid query: Access denied for user ‘id1805506_tt247_ex’@’%’ to database ‘xxxxxxxx’

somtime I get

mysql server has gone away

However I checked all the codes and settings, and can not find anything wrong.

Hi abcd123huy!

I have checked your website, but nothing seems to be wrong now…

On which page are you receiving this error? Could you please provide the code as well? Thanks :slight_smile:

page error on:

|MYSITE|/flat/app/manga/controllers/cont.mangaManagement.php?action=list

source page:

$con = mysql_connect(APP_DB_HOST,APP_DB_USER,APP_DB_PASSWORD);
mysql_select_db(APP_TABLES_PREFIX.‘manga_mangas’, $con);
if($_GET[“action”] == “list”)
{
$result = mysql_query("SELECT COUNT(*) AS RecordCount FROM ".APP_TABLES_PREFIX.“manga_mangas;”);
if (!$result) { // add this check.
die('Invalid query: ’ . mysql_error());
}
$row = mysql_fetch_array($result);
$recordCount = $row[‘RecordCount’];
$result = mysql_query("SELECT * FROM ".APP_TABLES_PREFIX."manga_mangas ORDER BY " . $_GET[“jtSorting”] . " LIMIT " . $_GET[“jtStartIndex”] . “,” . $_GET[“jtPageSize”] . “;”);
if (!$result) { // add this check.
die('Invalid query: ’ . mysql_error());
}
$rows = array();
while($row = mysql_fetch_array($result))
{
$rows[] = $row;
}

my config.php source:

<?php
  	/** mysql hostname */
  	define('APP_DB_HOST', 'localhost');
  	/** mysql database username */
  	define('APP_DB_USER', 'id1805506_tt247_ex');
  	/** mysql database password */
  	define('APP_DB_PASSWORD', 'xxxxxxxx');
  	/** mysql database name */
  	define('APP_DB_NAME', 'id1805506_tt247_');
  	/** mysql table prefix */
  	define('APP_TABLES_PREFIX', 'xxxxxxx');
  	/** Mail sender and config */
  	define('SMTP', '0'); // 1 for using SMTP, 0 for using mail();
  	/* IF SMTP = 1, define smtp config */
  	define('SMTP_HOST', 'smtp.gmail.com');
  	define('SMTP_PORT', '587');
  	define('SMTP_Secure', 'tls');
  	define('SMTP_Auth', 'true');
  	define('SMTP_Username', '');
  	define('SMTP_Password', '');
  	define('email_from', 'your_email@somewhere.com')
  ?>

get error:

Invalid query: Access denied for user ‘id1805506_tt247_ex’@’%’ to database ‘xxxxxxxxmanga_mangas’

mysql_select_db() must select a database not a table.

So it should be like this: mysql_select_db(APP_DB_NAME, $con);

I fixed it, thank you so much :smile:

1 Like