Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/design-patterns/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
can';t将我的数据插入数据库phpmyadmin_Php_Html_Database_Phpmyadmin_Registration - Fatal编程技术网

can';t将我的数据插入数据库phpmyadmin

can';t将我的数据插入数据库phpmyadmin,php,html,database,phpmyadmin,registration,Php,Html,Database,Phpmyadmin,Registration,我的代码有问题 我尝试使用php制作一个注册表 但我无法将数据插入数据库 这是我的密码 registration\u form.php 登记表 当我点击提交按钮时,错误信息就会出现 Object not found! The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of

我的代码有问题 我尝试使用php制作一个注册表 但我无法将数据插入数据库 这是我的密码

registration\u form.php 登记表

当我点击提交按钮时,错误信息就会出现

 Object not found!

 The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

 If you think this is a server error, please contact the webmaster.

 Error 404

 localhost
 08/08/12 23:46:37
 Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1
请帮我解决这个问题 谢谢



您的PHP文件名为
registration.PHP

您的表单操作名为
register.PHP
,但您的PHP文件名为
registration.PHP
,将表单操作更改为
registration.php

您试图在表单中访问
register.php
,而不是
registration.php

这看起来不像是数据库问题。而是找不到register.php。您已将文件保存为registration.php。

请注意,您的代码易受sql注入攻击。更多信息:还值得一提的是,PHP有很多框架,可以为您的应用程序添加身份验证。为什么要重新发明轮子?我真的不明白…曼斯菲尔德说,使用你写的代码意味着任何人都可以侵入你的网站,删除你所有的用户信息,甚至更糟。谷歌SQL注入攻击获取更多信息。我建议使用像Yii这样的PHP框架(它提供了一个开箱即用的登录系统)将比你自己编写的任何东西都更加可靠、稳定和安全。我明白了……嗯,我的程序已经开始工作了……谢谢你的建议:)@BudiCzras-你得到了一个404错误,这意味着你要查找的页面不在那里。您确定这两个都在同一个目录中吗?但您得到的错误不是PHP错误或MySQL错误,可能看起来有点像这样——相反,您的web服务器找不到web表单的目标,因此无法访问您为处理表单而编写的代码。
 $con=mysql_connect("localhost","root","");
 /* Now, we select the database */
 mysql_select_db("login&register");

 /* Now we will store the values submitted by form in variable */
 $username=$_POST['username'];
 $pass=$_POST['password'];
 /* we are now encrypting password while using md5() function */
 $password=md5($pass);
 $confirm_password=$_POST['confirm_password'];

 /* Now we will check if username is already in use or not */
 $queryuser=mysql_query("SELECT * FROM register WHERE username='$username' ");
 $checkuser=mysql_num_rows($queryuser);
 if($checkuser != 0)
 { echo "Sorry, ".$username." is already been taken."; }
 else {

 /* now we will check if password and confirm password matched */
 if($pass != $confirm_password)
 { echo "Password and confirm password fields were not matched"; }
 else {

 /* Now we will write a query to insert user details into database */
 $insert_user=mysql_query("INSERT INTO register (username, password) VALUES ('$username',     '$password')");

 if($insert_user)
 { echo "Registration Succesfull"; }
 else
 { echo "error in registration".mysql_error(); }

 /* closing the if else statements */
 }}

 mysql_close($con);
 ?>
 Object not found!

 The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

 If you think this is a server error, please contact the webmaster.

 Error 404

 localhost
 08/08/12 23:46:37
 Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1
<form method="post" action="register.php">