如何在连接mysql数据库时更新数据库? [英] How do I update the database in the connecting to mysql database?
问题描述
我的数据库名称= loginapp
表名=用户
而不是更新数据是我的sql添加一行
包括functions.php;
?>
if(isset($ _ POST ['submit'])){
UpdateTable();
}
?>
< html>
< head>
< title> ;这是登录页面< / title>
< link rel =stylesheethref =https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min .css>
< / head>
< body>
MY database name = loginapp
table name = users
rather that updating the data it is adding a row to my sql
include "functions.php";
?>
if(isset($_POST['submit'])){
UpdateTable();
}
?>
<html>
<head>
<title> THis is the login page </title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" >
</head>
<body>
< form action =login_update.phpmethod =post>
<form action="login_update.php" method="post">
< label for =username>用户名< / label>
<输入类型=textname =usernameclass =form-control>
<label for="username">Username</label>
<input type="text" name="username" class="form-control">
< label for =password>密码< / label>
< input type = passwordname =passwordclass =form-control>
<label for="password">Password</label>
<input type="password" name="password" class="form-control">
< select name = idid =>
showAllData();
?>
< / select>
<select name="id" id="">
showAllData();
?>
</select>
< input class =btn btn-primary type =submitname =registervalue =UPDATE>
< / form>
<input class="btn btn-primary" type="submit" name="register" value="UPDATE">
</form>
< / body> < br $> b $ b
< / html>
我的尝试:
i尝试了所有程序以及UPDATING,但看起来它像INSERT命令一样工作。
</body>
</html>
What I have tried:
i have tried all the procedures along with UPDATING but looks like it is working like a INSERT command.
推荐答案
_POST ['submit'])){
UpdateTable();
}
?>
< html>
< head>
< title>这是登录页面< / title>
< link rel =stylesheethref =https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min .css>
< / head>
< body>
_POST['submit'])){
UpdateTable();
}
?>
<html>
<head>
<title> THis is the login page </title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" >
</head>
<body>
< form action =login_update.phpmethod =post>
<form action="login_update.php" method="post">
< label for =username>用户名< / label>
<输入类型=textname =usernameclass =form-control>
<label for="username">Username</label>
<input type="text" name="username" class="form-control">
< label for =password>密码< / label>
< input type = passwordname =passwordclass =form-control>
<label for="password">Password</label>
<input type="password" name="password" class="form-control">
< select name = idid =>
showAllData();
?>
< / select>
<select name="id" id="">
showAllData();
?>
</select>
< input class =btn btn-primary type =submitname =registervalue =UPDATE>
< / form>
<input class="btn btn-primary" type="submit" name="register" value="UPDATE">
</form>
< / body> < br $> b $ b
< / html>
我的尝试:
i已经尝试了所有程序以及UPDATING,但看起来它的工作方式类似于INSERT命令。
</body>
</html>
What I have tried:
i have tried all the procedures along with UPDATING but looks like it is working like a INSERT command.
代码的位置在哪里UpdateTable()方法?
这是非常非常简单的解决方案。编写UPDATE语句而不是INSERT语句。
Where is the code for the UpdateTable() method?
This is very, very, easy solution. Write an UPDATE statement instead of an INSERT statement.
这篇关于如何在连接mysql数据库时更新数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!