Jump to content

Displaying data in DIV


Dark-Hawk

Recommended Posts

Alright, I have a div table which is hidden/shown as a menu by a JavaScript onmouseover as would be such:

<a href="#" onmouseover="divMenu.show('mAsian', this, 50, 10)" onmouseout="divMenu.hide('mAsian')">Item</a>

 

The div is setup as follows:

<div id="mAsian" class="menudiv" style="width: 120px">
<?

$result = mysql_query("SELECT * FROM menu ORDER BY shop") 
		or die(mysql_error());

while ($row = mysql_fetch_array($result))
{
?>
<div><a href="#" onmouseover="divMenu.show('m<? echo $row['shop']; ?>', this, 90, 10)"
  onmouseout="divMenu.hide('mReopen')">  <? echo $row['shop']; ?></a></div>
<?
}
?>

 

However, it simply is not working. All it returns is:

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

 

It's fine if I call the data like this:

<?
include_once("config.php");

$result = mysql_query("SELECT * FROM menu ORDER BY shop") 
		or die(mysql_error());

while ($row = mysql_fetch_array($result)) {

echo $row['shop'];
echo "<br>";
}
?>

But the second it's included with the DIV it throws the error as seen. I'm not sure if this is something wrong with my code, or if it's something wrong with my server. Any help would be greatly appreciated :).

Link to comment
https://forums.phpfreaks.com/topic/92727-displaying-data-in-div/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.