chand.sethi77 Posted March 27, 2011 Share Posted March 27, 2011 This is my code. <?php$connect = mysql_connect ("localhost", "root", ""); if (!$connect){ die ("error, Could not connect to mysql! " . " " . mysql_error()); }?><?php$select = mysql_select_db ("kiddo", $connect); if(!$connect){ die ("Couldn't connect to database." . " " . mysql_error()); }?><?php$name = $_POST['name'];$username = $_POST['username'];?><?php$sql = mysql_query ("INSERT INTO users (name, username) VALUES ($name, $username) ");if (!$sql){ die ("Error! Mysql Query failed." . " " . mysql_error());}else { echo "Registered successfully" . "<a href='registered.php'>" . "Click here" . "</a>" . "to see your name!";}?><?phpmysql_close ($connect)?> I have not factored it yet. The error is that is says "Error! Mysql Query failed. Unknown column 'Chand' in 'field list' " here Chand is $_POST['name'].WHat to do??????ThanksChaand Sethi Link to comment Share on other sites More sharing options...
[dx] Posted March 28, 2011 Share Posted March 28, 2011 VALUES ('$name', '$username') ") Link to comment Share on other sites More sharing options...
Twango Posted March 31, 2011 Share Posted March 31, 2011 Put '' around the values, also, you might want to put in the username and password for the mysql database. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.