Ok, I ran what it showed me

INSERT INTO users (first, last) VALUES ('hello2123', 'pass123321')

and it worked.

    It worked when you ran it against the database directly or on the page?

      Against the database directly. Still not on the page though.

        Well that sucks, sorry. I wrote that page real quick as an example, I didn't test it against a real DB.

        OK one difference I found from the code I sent you to what you're using is this:

        mysql_query($query);

        change to:

        $result = mysql_query($query);

        give that a try, If that doesn't work I'll grab some code from something that I know works.

          You may have to quote the field and table names if they might be reserved in the database system, e.g. password()
          $query = "INSERT INTO users (username, password) VALUES ('{$username}', '{$password}')";

          Also, you may wish to use mysql_error() in your case to check for database errors when debugging
          e.g.
          mysql_query($query) OR die(mysql_error());
          A more graceful method should be used in a production website, of course.

            Quoting the password and username didn't help, however the mysql_error came up with:

            No Database Selected

            which doesn't really make any sense. I checked, and I'm definatley selecting the right database, I even tried using a different one, but I still got the error.

              OK, this is a stretch now, but try moving the mysql_select_db("forums"); line to just above the $query line. There's no functions or anything to deal with so I don't know if this will do anything, but now I'm curious.

                Sorry for the slow reply. I tried moving the

                mysql_select_db("forums");

                but still got the error

                No Database Selected

                  8 days later

                  Do you have any idea why I may be getting these problems?

                    Can you show me your code again along with your database?

                      4 days later

                      Here is my code:

                      <?    $db = mysql_pconnect("localhost", "ma135yh_tf", "*******");    mysql_select_db("forums");    if (!$db) {    echo "Databse connection error. Will now die.";    exit;    }    $username = ('hello2123');    $password = ('pass123321');    $query = "INSERT INTO users (username, password) VALUES ('".$username."', '".$password."')";    mysql_query($query);    ?>
                        Write a Reply...