在我的代码中只是通过php将一些数据插入mysql数据库。插入所有数据,但只插入一列的数据。我的密码在这里:
<html>
<form action="registration.php" method="post">
First Name <input name="st_name" type="text" id="st_name">
Last Name <input name="f_name" type="text" id="f_name">
Department <input name="department" type="text" id="department">
Registration No <input name="regi_no" type="text" id="regi_no">
Email <input name="email" type="text" id="email">
pass:<input name="pass" type="password" id="pass">
<input type="submit" name="Submit" value="Submit">
</form>
</html>
提交后:
<?php
$st_name=$_POST["st_name"];
$st_lastname=$_POST["f_name"];
$dept=$_POST["department"];
$regi_no=$_POST["regi_no"];
$email=$_POST["email"];
$pass=$_POST["pass"];
$con = mysql_connect("localhost","root",""); // mysql connection
mysql_select_db("ppp", $con);
mysql_query("INSERT INTO registration VALUES('$st_name','$st_lastname','$dept','$session','$regi_no','$email','$pass')") or die(mysql_error());
mysql_close($con);
?>
1条答案
按热度按时间isr3a4wc1#
创建表
连接.php
索引.php
插入.php
选择.php
删除.php
更新.php