Dark-Hawk Posted February 24, 2008 Share Posted February 24, 2008 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 . Quote Link to comment Share on other sites More sharing options...
AndyB Posted February 24, 2008 Share Posted February 24, 2008 The error suggests you don't have the connection info available "inside the div". Probably you need the require_once to execute before all else. Quote Link to comment Share on other sites More sharing options...
Dark-Hawk Posted February 24, 2008 Author Share Posted February 24, 2008 Ah got it figured out; thanks for the help though . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.