...

View Full Version : Inserting Data (Mysql)



jdfskitz
09-04-2009, 12:02 AM
Can Someone show me how exactly I am supposed to make it so that and html code or php. w/e inserts a username password and other stuff into the database?

seco
09-04-2009, 12:36 AM
google can show you millions of ways.

this is from
http://www.tizag.com/mysqlTutorial/mysqlinsert.php
and will get you started


<?php
// Make a MySQL Connection
mysql_connect("localhost", "admin", "1admin") or die(mysql_error());
mysql_select_db("test") or die(mysql_error());

// Insert a row of information into the table "example"
mysql_query("INSERT INTO example
(name, age) VALUES('Timmy Mellowman', '23' ) ")
or die(mysql_error());

mysql_query("INSERT INTO example
(name, age) VALUES('Sandy Smith', '21' ) ")
or die(mysql_error());

mysql_query("INSERT INTO example
(name, age) VALUES('Bobby Wallace', '15' ) ")
or die(mysql_error());

echo "Data Inserted!";

?>

jdfskitz
09-04-2009, 12:56 AM
Hmm .. im having issues..

Account.html Page:


<html>
<head>
</head>
<title>
</title>
<body>
<body>
<h4>Account Page</h4>
<form action="login.php" method="post">
Username: <input type="text" size="10" maxlength="40" name="username"> <br />
Password: <input type="password" size="10" maxlength="10" name="password">
date of birth: <input type="text" size="10" maxlength="40" name="dob"> <br />
Country: <input type="text" size="10" maxlength="40" name="country"> <br />
Gender: <input type="text" size="10" maxlength="40" name="gender"> <br />
<input type="submit" />
</form>
</body>
</body></html>


login.php page (account creation):


<html><body>
<?php
// Make a MySQL Connection
mysql_connect("localhost", "root", "password") or die(mysql_error());
mysql_select_db("accounts") or die(mysql_error());

// Insert a row of information into the table "example"
mysql_query("INSERT INTO example
(userid, username, password, country, ip, gender, dob) VALUES('+1', 'username', 'password', 'date of birth', 'country', 'gender' ) ")
or die(mysql_error());

echo "Data Inserted!";

?>
</body></html>

...

can someone help me?

jdfskitz
09-04-2009, 01:13 AM
http://ddhost.ath.cx/database.bmp

tomws
09-04-2009, 01:57 AM
can someone help me?

Yes: state your problem. "im having issues" is a lousy problem description.

jdfskitz
09-04-2009, 04:24 AM
make the code to create accounts into my database and show me how to fix my code...

[vengeance]
09-04-2009, 11:03 AM
make the code to create accounts into my database and show me how to fix my code...

I think it's too soon for you to jump into this project, if you don't know what your problem is, and where it's located.
You need to understand the code first.

I'd suggest you to read the HTML tutorials first and then PHP on e.g. w3schools (http://www.w3schools.com). Take it one step at a time, and it'll be a piece of cake afterwards.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum