Jump to content

database connection issue (formerly DUDE!!!!!!!!)


ericburnard

Recommended Posts

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

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