Copy link to clipboard
Copied
Hi,
I am trying to delete a record but the process is taking too long then it crashes mysql and give this:
Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'localhost' (10048) indb.php on line 9
Fatal error: Can't connect to MySQL server on 'localhost' (10048)
my page is:
echo '<ul id="wall">';
$sqlMSG = "SELECT * FROM wall LEFT JOIN users ON wall.user_to = users.user_id WHERE user_to = '$_SESSION[user_id]' ORDER BY wall_id DESC";
$res = mysql_query($sqlMSG) or exit(mysql_error());
while ($row = mysql_fetch_array($res))
{?>
<table width="100%" border="0" cellspacing="5" cellpadding="5">
<tr>
<td width="40px" valign="top"><img src="resize/Thumb.php?src=../user_pics/<?php echo $row['photo'];?>&w=40" /></td>
<td valign="top"><table width="100%" border="0" cellspacing="3" cellpadding="3">
<tr>
<td valign="top"><div align="left"><?php echo $row['message'];?></div></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="left">Date: <?php echo $row['date'];?> </div></td>
<td><div align="right"><a href="home.php?wall_id=<?php echo $row['wall_id'];?>"/><img src="images/icons/delete-comment-green.gif" width="14" height="14" border="0" /></a></div></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<hr />
<?php }
echo '</ul>';
?>
The SQL is:
if ((isset($_GET['wall_id'])) && ($_GET['wall_id'] != "")) {
$deleteSQL = sprintf("DELETE FROM wall WHERE wall_id=%s",
GetSQLValueString($_GET['wall_id'], "int"));
mysql_select_db($database_db, $db);
$Result1 = mysql_query($deleteSQL, $db) or die(mysql_error());
$deleteGoTo = "home.php";
if (isset($_SERVER['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}
What am I doing wrong?
Copy link to clipboard
Copied
The_FedEx_Guy wrote:
What am I doing wrong?
You're looking in the wrong place. Read the error message again.
Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'localhost' (10048) indb.php on line 9
Fatal error: Can't connect to MySQL server on 'localhost' (10048)
It can't connect to MySQL. Presumably, indb.php is your connection script. The fatal error occurs on line 9 of that script, and it never gets to any of the code that you have pasted here. Either you have the wrong connection details, or there's something wrong with your MySQL server.
Copy link to clipboard
Copied
I think it could be something wrong with the MySql server
Find more inspiration, events, and resources on the new Adobe Community
Explore Now