我有两种表格形式。我可以成功地将数据存储到数据库。当表单提交的用户将指向第二个表单。我将 url 中的变量$ uniqueid从第一种形式传递给第二种形式。但是,当我尝试将第二种形式的数据存储到与未存储的相同用户相关的数据库中时。
我想存储用户的手机号码,从第二页.databse列也是手机号码。
This is my code
<?php
include_once 'dbconnect.php';
$a = $_GET['uniquekey'];
if(isset($_POST['btn-signup']))
{
$mobilenumber = $_POST['mobilenumber'];
$xxx = mysql_query("SELECT * FROM who WHERE uniquekey = '$a'")or die(mysql_error());
$yyy = mysql_fetch_row($xxx);
if(mysql_num_rows($xxx) > 0) {
$aaa = mysql_query("INSERT INTO who(mobilenumber) VALUES('$mobilenumber')");
}
else{
echo 'wrong';
}
}
?>
答案 0 :(得分:0)
$xxx = mysql_query("SELECT * FROM who WHERE uniquekey = '$a'")or die(mysql_error());
$yyy = mysql_fetch_row($xxx);
if(mysql_num_rows($xxx) > 0) {
$aaa = mysql_query("UPDATE who setmobilenumber='$mobilenumber' where uniquekey = '$a' ");
}
else{
echo 'wrong';
}
您可以在此处使用更新查询来更新用户手机号码。
答案 1 :(得分:0)
std::stringstream