Jump to content

darkwaters

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

darkwaters's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi there, I'm new to PHP and MySQL. I've self studied the basics online and I have worked through the basics by doing practical examples which I found on w3school.com. I am now trying to connect to and create a database through an example I'm working through. I don't have a localhost so I'm testing my work online with a page that is not linked to my site. In saying that, here is the code I a using: line) 1) <!-- Connecting and creating a table with PHP and MySQL --> 2) <?php 3) $con = mysql_connect("world-casino-guide.com","username","password"); 4) if (!$con) 5) { 6) die('Could not connect: ' .mysql_error()); 7) } // Create Database "newsletter" if (mysql_query("CREATE DATABASE newsletter", $con)) { echo "Database Created"; } else { echo "Error Creating Database: " . mysql_error(); } // Create Table "registrations" in "newsletter" database mysql_select_db("newsletter", $con); $sql = "CREATE TABLE registrations ( Name varchar(25), Email varchar(50), PRIMARY KEY(Email), Casino varchar(10), Poker varchar(10), Bingo varchar(10), )"; mysql_query($sql,$con); mysql_close($con); ?> However, when I upload and run the page, I receive this error: Warning: mysql_connect(): Can't connect to MySQL server on 'world-casino-guide.com' (111) in /home/content/d/o/n/username/html/wcg_new_design/include_mysql_test1.php on line 3 Could not connect: Can't connect to MySQL server on 'world-casino-guide.com' (111) I'm not sure how to resolve the above. Can anyone help me with this? My final goal is to have a double opt. in registration system. I do however want to learn at the same time so happy to work through the basics. If anyone could provide further information or code to have a double opt in system, it would be much appreciated. Thanks, Douglas
×
×
  • 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.