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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.