Jump to content

xampp database problems


cesc

Recommended Posts

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

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.

 

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  :)

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.