Fout in script help??
-----------------mysql.php-----------------------------
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
<?php
$host = "localhost";
$user = "root";
$pass = "";
$dbdb = "maschel";
if (!@mysql_select_db($dbdb, @mysql_connect($host, $user, $pass)))
{
echo "couldn't make a connection with mysql server...<b></b>";
echo "Try again in serval minutes... if it still doesn't works contact me on [email protected]<br>";
}
?>
$host = "localhost";
$user = "root";
$pass = "";
$dbdb = "maschel";
if (!@mysql_select_db($dbdb, @mysql_connect($host, $user, $pass)))
{
echo "couldn't make a connection with mysql server...<b></b>";
echo "Try again in serval minutes... if it still doesn't works contact me on [email protected]<br>";
}
?>
------------------register_form.html-------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Maschel.nl > Register</title>
</head>
<body>
<form method="POST" action="register.php">
<h3>maschel.nl member system beta 1.0</h3><br><br><br>
username: <input type="text" name="username" size="25" maxlength="25">*<br>
email: <input type="text" name="email" size="25" maxlength="40">*<br>
confirm email: <input type="text" name="con_email" size="25" maxlength="40">*<br>
password: <input type="password" name="password" size="25" maxlength="25">*<br>
confirm password: <input type="password" name="con_password" size="25" maxlength="25">*<br><br>
name: <input type="text" name="name" size="25" maxlength="35"><br>
country: <input type="text" name="country" size="25" maxlength="25"><br>
msn: <input type="text" name="msn" size="25" maxlength="40"><br>
website: <input type="text" name="website" size="25" maxlength="25"><br><br>
<input type="submit" name="submit" value="submit"><br><br>
everything with a * must be filled in!
</form>
</body>
</html>
--------------------register.php--------------------------
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
//maschel.nl member system beta 1.0
echo "<h3>maschel.nl member system beta 1.0</h3><br><br<br>\n";
//maschel.nl member system beta 1.0
require("mysql.php");
if (isset($_POST["username"]) && isset($_POST["email"]) && isset($_POST["con_email"]) && isset($_POST["password"])
&& isset($_POST["con_password"]) && ($_POST["password"] == $_POST["con_password"] && $_POST["email"] == $_POST["con_email"]))
{
$sql = "INSERT INTO member (id, username, email, password, name, country, msn, website) VALUES ('', '$HTTP_POST_VARS[username]', '$HTTP_POST_VARS[email]', '$HTTP_POST_VARS[password]', '$HTTP_POST_VARS[name]', '$HTTP_POST_VARS[country]', '$HTTP_POST_VARS[msn]', '$HTTP_POST_VARS[website]";
$res = mysql_query($sql);
if ($res)
{
echo "Your account is sucsesfully added.";
}
else
{
echo "An error has encorred please try again.";
}
}
else {
echo "You didn't fill in everything! and/or user/user and/or pass/pass aren't the same<br>\n";
echo "<a href=\"register_form.html\">Click here to go back<br><br>\n";
}
?>
//maschel.nl member system beta 1.0
echo "<h3>maschel.nl member system beta 1.0</h3><br><br<br>\n";
//maschel.nl member system beta 1.0
require("mysql.php");
if (isset($_POST["username"]) && isset($_POST["email"]) && isset($_POST["con_email"]) && isset($_POST["password"])
&& isset($_POST["con_password"]) && ($_POST["password"] == $_POST["con_password"] && $_POST["email"] == $_POST["con_email"]))
{
$sql = "INSERT INTO member (id, username, email, password, name, country, msn, website) VALUES ('', '$HTTP_POST_VARS[username]', '$HTTP_POST_VARS[email]', '$HTTP_POST_VARS[password]', '$HTTP_POST_VARS[name]', '$HTTP_POST_VARS[country]', '$HTTP_POST_VARS[msn]', '$HTTP_POST_VARS[website]";
$res = mysql_query($sql);
if ($res)
{
echo "Your account is sucsesfully added.";
}
else
{
echo "An error has encorred please try again.";
}
}
else {
echo "You didn't fill in everything! and/or user/user and/or pass/pass aren't the same<br>\n";
echo "<a href=\"register_form.html\">Click here to go back<br><br>\n";
}
?>
dit krijg ik als antwoord:
An error has encorred please try again.
maar dit snap ik niet want als het goed is zou het moeten werken.
deze tabel heb ik toegevoegd in mysql:
CREATE TABLE member(
id int(11) auto_increment primary key,
username varchar(25) not null,
email varchar(40) not null,
password varchar(25) not null,
name varchar(35),
country varchar(25),
msn varchar(40),
website varchar(25)
);
Gewijzigd op 03/01/2005 14:54:00 door Geoffrey Mastenbroek
Heb je een mysql error?
wat ik dus zelf heb gemaakt maar als ik in phpmyadmin kijk dan zie ik dat er nix is toegevoegd maar waarschijnlijk dus geen mysql error
kan je niet beter gewoon $_post blijven gebruiken is wat overzichtelijker enzo.
omdat ik eerst d8 dat je $_POST niet een een mysql code kon gebruiken maar dat lag het niet aan
if($res != false){
echo "Your account is sucsesfully added.";
}
else
{
echo "An error has encorred please try again.";
}
Heb het geprobeert maar het maakt niks uit :(
Lees eens uit wat er in $res staat.
$res is leeg :D dus daar zit het probleem maar wat is er verkeerd?
Soms wil het helpen dat je de SQL ziet, geef een echo van $sql dan zie je meestal het. Misschien een bepaalde waarde niet of een komma vergeten... dat kan je dan meestal makkelijk zien
INSERT INTO member (id, username, email, password, name, country, msn, website) VALUES ('', 'test', '[email protected]', 'test', 'Geoffrey Mastenbroek', 'Netherlands', '[email protected]', 'www.maschel.nl
ik zie hier zelf geen fout in maar?
ik was na www.maschel.nl dus $_POST voor website ') vergeten
maar nu doet iet het.
bedankt voor goede/snelle reacties ;)
if ($res)
{
echo "Your account is sucsesfully added.";
}
else
{
echo "An error has encorred please try again.";
echo('<br>'.mysql_error());
}
Ja, goed idee thnx