Hello, I am new to working with PHP and MySQL so I'm sure my mistake(s) are simple enough. Basically, I'm trying to write a script(s) to add a row to a MySQL database. I took the scripts below off a website and have been trying to tweak them to do what i want. Unfortunately, the script usually gives me an error message (the one defined in the script) and very occassionally inserts a blank row in the database. Any clues or advice on what I am doing wrong would be greatly appreciated. Unfortunately, I have not found the solution on the web or MySQL site (probably because I have no idea what I'm doing). Thanks! - Ken <HTML> <form name="mailadmin" method=POST action="test2.php"> userid: <input type="text" name="userid"><br> passwd: <input type="text" name="passwd"><br> <input type="submit" name="submit" value="submit"> </form> </HTML> <?PHP //Our PHP/MYSQL page. //This script takes the data from the form //fields and adds them to specified parts //parts of the database //MySQL Variables. Edit where necessary session_start(); $host = "localhost"; $login_name = "root"; $password = "ronin0567*"; //Connecting to MYSQL MySQL_connect("$host","$login_name","$password"); //Select the database we want to use MySQL_select_db("dbmail") or die("Could not select database"); //Assign contents of form to variables #$userid = $_POST['userid']; #$passwd = $_POST['passwd']; $sql = "INSERT INTO users (userid, passwd) VALUES (userid = 'userid', passwd = 'passwd')"; $result = mysql_query($sql); //Code to check if statement executed properly and display message if ($result) { echo("userid and passwd successully added"); } else { echo("An error occured"); } //Close connection with MySQL mysql_close(); ?> -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php