treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Chat2: Group Chat Room

  • Hello and Greetings,

    My name is Timothy. I am a barely competent web programmer, and learning a lot from this site.

    I want to get the "Chat2: Group Chat Room" going on my website, but I'm having challenges I can't resolve.

    I uploaded and extracted all the files given in the demo to my website. And when I go to test, I input my username, and then receive a "Could not connect" on the follow-up page.

    What did I not do? What do I need to do?

    Thank you, Timothy

  • I suppose it could be useful to include a link to the site: http://www.becomealivinggod.com/Chat2

  • Have you configured dbcon.php? Do you have a database called chat2_db? I believe you need to use Setup.sql to add the tables to the database.

  • Please forgive me and my incompetence.

    How do I configure dbcon.php? Do I manually create the database chat2_db? And how do I use Setup.sql to add the tables?

    I attempted to create my own database and insert its name into the files, but it failed.

    I swear I am reasonably intelligent, I just don't know exactly what you're talking about.

  • dbcon.php needs to know how to access your MySQL database. On my laptop, for example, I have apache, php and a mysql setup for localhost connections. My login name is, naturally, "example" and my password is "3x4mpl3_p4ssw0rd". Someone told me once that it was smart to use letters and numbers, and I have been ever since. The top of dbcon.php therefore looks like:

    define(HOST, 'localhost');
    define(USERNAME, 'example');
    define(PASSWORD, '3x4mpl3_p4ssw0rd');
    

    To set up the database, go into MySQL and create the database:

    CREATE DATABASE chat2_db;
    

    To execute Setup.sql, navigate in the terminal to the directory with Setup.sql in, then execute the following:

    mysql -u example -p chat_db < Setup.sql
    

    Remember that example is my username, not yours, and you might need to put something else in. You will be prompted for your password.

    Alternatively, I'm sure PHPMyAdmin will have a nice interface for all of this.