cesc Posted April 9, 2008 Share Posted April 9, 2008 Hey guys, iv recently started using xampp with mysql, apache and phpmyadmin! i'm trying to insert data into a table (called members)that i have created in a database called "walkers" from a simple html form. I'm getting no errors what so ever yet i have no data appearing in my table. Could someone have a look and give me any tips, thanks! when i log into phpmyadmin and check the table called "members", there is no data in it at all! heres the simple html form: <html> <body> <form action="http://localhost/registration.php" method="post"> username: <input type="text" name="username" /> <br> password: <input type="text" name="password" /> <br> <input type="submit" /> </form> </body> </html> and heres my php script: <?php mysql_connect("localhost", "root", "*******"); mysql_select_db("walkers"); $sql="INSERT INTO members (username, password) VALUES ('$_POST[username]', '$_POST[password]')"; echo "well done, you are now registered"; mysql_close(); ?> im trying to create a simple registration form, thanks! any help will be greatly appreciated B Link to comment https://forums.phpfreaks.com/topic/100346-xampp-database-problems/ Share on other sites More sharing options...
ninedoors Posted April 9, 2008 Share Posted April 9, 2008 Check to make sure that your primary key is set to auto-increment. I spent a couple days trying to figure that one out when I started working with phpmyadmin. That is the only thing I can think of. Link to comment https://forums.phpfreaks.com/topic/100346-xampp-database-problems/#findComment-513088 Share on other sites More sharing options...
ninedoors Posted April 9, 2008 Share Posted April 9, 2008 Check to make sure that your primary key is set to auto-increment. I spent a couple days trying to figure that one out when I started working with phpmyadmin. That is the only thing I can think of. Thats probably not the problem as I look at you post again. You need to actually query the database with: mysql_query($sql); Put that below your INSERT statement. Link to comment https://forums.phpfreaks.com/topic/100346-xampp-database-problems/#findComment-513090 Share on other sites More sharing options...
cesc Posted April 9, 2008 Author Share Posted April 9, 2008 Check to make sure that your primary key is set to auto-increment. I spent a couple days trying to figure that one out when I started working with phpmyadmin. That is the only thing I can think of. Thats probably not the problem as I look at you post again. You need to actually query the database with: mysql_query($sql); Put that below your INSERT statement. That worked, thanks for the help guys Link to comment https://forums.phpfreaks.com/topic/100346-xampp-database-problems/#findComment-513178 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.