| 1. |
Solve : "Inventory" for HTML RPG? |
|
Answer» No. The ERROR you're reporting indicates that the mysql function library is not loaded, for some reason. You would get a DIFFERENT error if you were having a DB authentication problem. Consider it done.Haven't heard from you... try PM? Congratulations on getting the 'job'!Hello, rob! Excellent news! I was browsing my services list and say MySQL disabled. I set it to manual and enabled it. Well, that solved that error... ...but now I get a different one: Warning: mysql_connect() [function.mysql-connect]: Access denied for user '[email protected]''localhost' (using password: YES) in C:\Program Files\Apache Group\Apache2\htdocs\test.php on line 9 Could not connect: Access denied for user '[email protected]''localhost' (using password: YES)Ah. That's somewhat easier to resolve. You should not be sending '[email protected]''localhost' verification credentials. In this case, you should be sending just '[email protected]'. Can you please post a code snippet of your connection attempt? (Or refer me to it if you've already posted it. ) Blank out the password, naturally. Code: [Select]$link = mysql_connect('localhost', '[email protected]', '*******') or die('Could not connect: ' . mysql_error()); I did that because I thought it said to log in with the host, the user, and the PW. :-/ At least, that was the idea I got from the first example here. [edit]On a whim, I removed the localhost from the username. I got this error: Quote Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'localhost' (10061) in C:\Program Files\Apache Group\Apache2\htdocs\test.php on line 9 Putting the localhost back in gave me the same error. :-?[/edit]Like I said, code snippet please. Until I see what you're doing, I can only speculate how to fix it.That code at the top of my last post isn't it? The whole code for that page is Code: [Select]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> <?php $link = mysql_connect('localhost', '[email protected]', '******') or die('Could not connect: ' . mysql_error()); ?> <p>Connected successfully</p> <?php mysql_select_db('inventory') or die('Could not select database'); $query = 'SELECT * FROM items'; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); ?> <table> <?php while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { ?> <tr> <?php foreach ($line as $col_value) { ?> <td><?php echo ($col_value != '' ? $col_value : ' '); ?></td> <?php } ?> <tr> <?php } ?> </table> <?php mysql_free_result($result); mysql_close($link); ?> </body> </html>I'm so SORRY - I've no idea how I missed that before! Right, now your connection syntax should be as follows: $link = mysql_connect('localhost', 'root', '********') or die ('Could not connect: ' . mysql_error()); i.e. leave out the 'localhost" bit. MySQL permissions are specific to the host from which you're connectiing (and this is detected automatically), so you can only connect from localhost as root, if you have already given yourself this permission. The error you're seeing could be due to a permissions error, or it could be due to a non-listening MySQL server. Double-check that the MySQL server is running. I'm assuming you didn't change the default port when you installed it. Ensure that your firewall is not blocking connections on that port (3306). The MySQL installation on Windows comes with some GUI clients; you can try using them to connect to the server. You can also try the tests on this page. I recommend bookmarking the MySQL reference pages, if you haven't already done so. I refer to them all the time. Report back, and do bear with me if I appear to be blind or stupid... Hey, missing a piece of a post is a common, everyday mistake. I do it all the time, as is evident with my Linux thread. The line Quote do bear with me if I appear to be blind or stupid... Ought to be coming from me! I'll do this after school, but right now I'm just checking the forums and modifying my mental "to do list". Or am I just mental? |
|