ericburnard Posted December 22, 2007 Share Posted December 22, 2007 Right ive written my own code used other people taken bits out of programs all i can think off but i cant connect to my database. The host address, username, and password are all correct its just it cannot connect to the database. all the letters are in lower case there is something in the database for it to display. Its getting right up my nose now!!! Any help would be amazing Thanks Eric x Link to comment https://forums.phpfreaks.com/topic/82849-database-connection-issue-formerly-dude/ Share on other sites More sharing options...
AndyB Posted December 22, 2007 Share Posted December 22, 2007 None of us has a crystal ball. Show us some code. Describe the errors you get, including error messages. Link to comment https://forums.phpfreaks.com/topic/82849-database-connection-issue-formerly-dude/#findComment-421366 Share on other sites More sharing options...
Barand Posted December 23, 2007 Share Posted December 23, 2007 I only looked at this to see what Andy's response was. Normally I'd ignore such a meaningless topic title, and I don't like being shouted at. Link to comment https://forums.phpfreaks.com/topic/82849-database-connection-issue-formerly-dude/#findComment-421395 Share on other sites More sharing options...
PHP_PhREEEk Posted December 23, 2007 Share Posted December 23, 2007 Based on the post title, I thought for sure a Surf report had errantly found its way onto the MySQL Help Forum. = D PhREEEk Link to comment https://forums.phpfreaks.com/topic/82849-database-connection-issue-formerly-dude/#findComment-421401 Share on other sites More sharing options...
ericburnard Posted December 25, 2007 Author Share Posted December 25, 2007 Sorry about that. im new and didnt realise about the topic names. The one i am trying now is on this site - http://www.phpfreaks.com/tutorials/142/6.php I took the last bit out because the "Forment" bit wasnt working so i now have this - <?php // database information $host = '********'; $user = '*********'; $password = '*********'; $dbName = '********'; // connect and select the database $conn = mysql_connect($host, $user, $password) or die(mysql_error()); $db = mysql_select_db($dbName, $conn) or die(mysql_error()); // insert new entry in the database if entry submitted if (isset($_POST['newEntry']) && trim($_POST['newEntry']) != '') { // for easier variable handling... $newEntry = $_POST['newEntry']; // insert new entry into database $sql = "insert into testTable (someField) values ('$newEntry')"; $result = mysql_query($sql, $conn) or die(mysql_error()); } // end if new entry posted // select all the entries from the table $sql = "select someField from testTable"; $result = mysql_query($sql, $conn) or die(mysql_error()); // echo out the results to the screen while ($list = mysql_fetch_array($result)) { echo "{$list['someField']} <br>"; } // end while ?> All i am getting is this error Access denied for user 'erikee10_eric'@'%' to database 'testTable' The username and password are correct, and i dont no what else to think of. Its bound to be really really simple but nevermind. Any help would be much loved Cheers Eric xxxxxxxx Link to comment https://forums.phpfreaks.com/topic/82849-database-connection-issue-formerly-dude/#findComment-423050 Share on other sites More sharing options...
revraz Posted December 25, 2007 Share Posted December 25, 2007 Probably the wrong DB name Link to comment https://forums.phpfreaks.com/topic/82849-database-connection-issue-formerly-dude/#findComment-423085 Share on other sites More sharing options...
ericburnard Posted December 26, 2007 Author Share Posted December 26, 2007 Probably the wrong DB name No the database name is exactly the same. Im stumpped Help Please!!! Link to comment https://forums.phpfreaks.com/topic/82849-database-connection-issue-formerly-dude/#findComment-423579 Share on other sites More sharing options...
Barand Posted December 26, 2007 Share Posted December 26, 2007 If host, user, password and database are all correct then it sounds like the user hasn't been granted permission to access the database Link to comment https://forums.phpfreaks.com/topic/82849-database-connection-issue-formerly-dude/#findComment-423595 Share on other sites More sharing options...
ericburnard Posted December 26, 2007 Author Share Posted December 26, 2007 If host, user, password and database are all correct then it sounds like the user hasn't been granted permission to access the database How do i change it so the user does? Link to comment https://forums.phpfreaks.com/topic/82849-database-connection-issue-formerly-dude/#findComment-423673 Share on other sites More sharing options...
revraz Posted December 26, 2007 Share Posted December 26, 2007 What type of access do you have to the database? Is this the only id/pw you have? Is this a shared webhost? Link to comment https://forums.phpfreaks.com/topic/82849-database-connection-issue-formerly-dude/#findComment-423682 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.