9 个解决方案
#1
<form action = "changepassword.php" method = "post" ></form>
#2
你只构造了一条 SQL 指令在 $sql 变量中,但并未执行他
#3
还有你这条sql里的变量是不会解析的
#4
注意字符串拼接遍历应该这样:$sql = "update usertry set password = " . $b . " where username = " . $a;
还有拼装完sql语句后你还没有执行:mysql_query($sql);
还有拼装完sql语句后你还没有执行:mysql_query($sql);
#5
#6
#7
onclick里面调用的是js函数,你直接用服务器端php的语法肯定是有问题的
#8
$db = mysql_connect('YOUR_DB_ADDRESS','YOUR_DB_USER','YOUR_DB_PASS') or die("Database error");
mysql_select_db('YOUR_DB', $db);
//SOLUTION:: add this comment before your 1st query -- force multiLanuage support
$result = mysql_query("set names 'utf8'");
$query = "select * from YOUR_DB_TABLE";
$result = mysql_query($query);
没事多去PHP官网看看吧
#9
楼上都说的对,
1. <form action = "changepassword.php" method = "post" ></form>
2. 在定义$sql="update usertry set password=".$b." where username=".$a;
然后执行:$conn->query($sql);
** 不过:
连接数据库时用的是: mysqli( "localhost", "usename", "password", "databasename"); 的话,查询用 $conn->query($sql);
连接数据库时用的是: mysqli_connect( "localhost", "usename", "password", "databasename"); 的话,查询用 mysqli_query($conn, $sql);
1. <form action = "changepassword.php" method = "post" ></form>
2. 在定义$sql="update usertry set password=".$b." where username=".$a;
然后执行:$conn->query($sql);
** 不过:
连接数据库时用的是: mysqli( "localhost", "usename", "password", "databasename"); 的话,查询用 $conn->query($sql);
连接数据库时用的是: mysqli_connect( "localhost", "usename", "password", "databasename"); 的话,查询用 mysqli_query($conn, $sql);
#1
<form action = "changepassword.php" method = "post" ></form>
#2
你只构造了一条 SQL 指令在 $sql 变量中,但并未执行他
#3
还有你这条sql里的变量是不会解析的
#4
注意字符串拼接遍历应该这样:$sql = "update usertry set password = " . $b . " where username = " . $a;
还有拼装完sql语句后你还没有执行:mysql_query($sql);
还有拼装完sql语句后你还没有执行:mysql_query($sql);
#5
#6
#7
onclick里面调用的是js函数,你直接用服务器端php的语法肯定是有问题的
#8
$db = mysql_connect('YOUR_DB_ADDRESS','YOUR_DB_USER','YOUR_DB_PASS') or die("Database error");
mysql_select_db('YOUR_DB', $db);
//SOLUTION:: add this comment before your 1st query -- force multiLanuage support
$result = mysql_query("set names 'utf8'");
$query = "select * from YOUR_DB_TABLE";
$result = mysql_query($query);
没事多去PHP官网看看吧
#9
楼上都说的对,
1. <form action = "changepassword.php" method = "post" ></form>
2. 在定义$sql="update usertry set password=".$b." where username=".$a;
然后执行:$conn->query($sql);
** 不过:
连接数据库时用的是: mysqli( "localhost", "usename", "password", "databasename"); 的话,查询用 $conn->query($sql);
连接数据库时用的是: mysqli_connect( "localhost", "usename", "password", "databasename"); 的话,查询用 mysqli_query($conn, $sql);
1. <form action = "changepassword.php" method = "post" ></form>
2. 在定义$sql="update usertry set password=".$b." where username=".$a;
然后执行:$conn->query($sql);
** 不过:
连接数据库时用的是: mysqli( "localhost", "usename", "password", "databasename"); 的话,查询用 $conn->query($sql);
连接数据库时用的是: mysqli_connect( "localhost", "usename", "password", "databasename"); 的话,查询用 mysqli_query($conn, $sql);