Jump to content

i cant connect to mysql


jimmyt1988

Recommended Posts

    mysql_connect("serverlocation", "username", "password") or die(mysql_error());
    mysql_select_db("databasename") or die(mysql_error());
    
    foreach ($myArray as $output){
        $sql="INSERT INTO maleNames 
        (Name) VALUES('$output') ";
        or die(mysql_error());
        $i++;
    }
    echo $i;

    echo "Data Inserted!";
    mysql_close($con);

 

It comes up with error: Error: No database selected

 

Any ideas?

 

Obviously the connecting credentials are replaced with username, password etc rather than the real.

Link to comment
https://forums.phpfreaks.com/topic/205594-i-cant-connect-to-mysql/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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