im currently trying to learn php but i cant figure out how to make this program work..
this is what i want.. i would like to create a simple PHP application that will enable the user to add, delete, search and update records in my sql database..im currently having troubles with adding records to my database... so i cant proceed to deleting, searching and updating... Im also trying to make it all work in one file only (if it is possible to do) can anyone help me with this?
this is my code
<html>
<body>
<form action="j.php" method="post">
Username: <input type="text" name="username" />
Password: <input type="text" name="password" />
First: <input type="text" name="first" />
Last: <input type="text" name="last" />
about: <input type="text" name="about" />
<input type="submit" />
</form>
</body>
</html>
<?php
$accounts = mysql_connect("localhost" , "root" , "jeromepogi") or die(mysql_error());
mysql_select_db("accounts", $accounts);
$sql = "INSERT INTO users (Username, Password, First, Last, About) VALUES('$_POST[username]', '$_POST[password]', '$_POST[first]', '$_POST[last]', '$_POST[about]')";
if (!mysql_query($sql, $accounts))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($accounts);
?>
PHP--MYSQL problem
Page 1 of 11 Replies - 143 Views - Last Post: 19 November 2012 - 10:23 PM
Replies To: PHP--MYSQL problem
#2
Re: PHP--MYSQL problem
Posted 19 November 2012 - 10:23 PM
Do not open duplicate threads. Also, please use code tags:
.
Page 1 of 1
|
|

New Topic/Question
This topic is locked




MultiQuote







|