Hello, I'm really new to website making and I am making one for an assignment.
I have made one myself here http://fcsit-trackandtrace.webatu.com/
Now the part where I'm really confused is to make a user login system, any help on that?
Hello, I'm really new to website making and I am making one for an assignment.
I have made one myself here http://fcsit-trackandtrace.webatu.com/
Now the part where I'm really confused is to make a user login system, any help on that?
Did you search this forum?
Yes I have, I've already made a database within myPHP in my hosting website. And now I'm having trouble connecting to the database from my website.
This is my registration.php
<?php
$user_name = "xxx";
$password = "";
$database = "website";
$server = "xxx";
mysql_connect($server, $user_name, $password);
mysql_select_db($database, $db_handle);
("INSERT INTO `website` ( `fname`, `lname`, `email`, `username`,`password`)
VALUES
('$_POST[first_name]','$_POST[last_name],'$_POST[email]','$_POST[username]','$_POST[password]')");
echo "success";
?>
And this is the signup.html:
<html><head><title>Sign Up</title></head>
<body bgcolor="yellow">
<p>Registration Form </p>
<table><td>
<form method="post" action="registration.php">
<p>Username:</p>
<input type="text" name="username">
<p>Password:</p>
<input type="password" name="pw">
<p>First name:</p>
<input type="text" name="fname">
<p>Last name:</p>
<input type= "text" name="lname">
<p>Email:</p>
<input type="text" name="email">
<input type="submit">
</form></td>
</table>
</body>
</html>
It just doesn't seem to work.
Am guessing you figured out mysql_query
was missing?
No not really, I kinda put the codes in the wrong way in Dreamweaver but I solved that.
Now weird thing is I'm getting problems trying to connect to the mysql server.
It keeps saying this in error: "Host 'xx.xx.xx.xx' is not allowed to connect to this MySQL server in /xx/xxx/xxx/registration.php on line 2"
My current registration.php:
(Note: yes my username and database name is the same, I kinda accidentally named it the same)
(Note2: my webhost told me to use mysql2.000webhost.com as the host name)
<?php
mysql_connect('xxx.000webhost.com','xxx','xxx') or die("Cannot connect.");
mysql_select_db('xxx') or die("Cannot connect.");
mysql_query
("INSERT INTO `website` ( `fname`, `lname', `email`, `username`,`password`)
VALUES
('$_POST[first_name]','$_POST[last_name]'$_POST[email]','$_POST[username]','$_POST[pw]')");
echo "Registration success!";
?>
Don't you have to allow your IP address in a remote SQL setting on your host for this to work?
Oh I kinda fixed it again, I made a new database with different username & database name and it works now.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.