我一直在尝试许多方法来更新我的 sql 数据库中名为juytdb
具有列users
名称的表username
和email
. 首先我尝试连接并且连接成功,
$localhost = "localhost";
$dbuser = "google";
$dbpass = "";
$dbname = "juytdb";
$connect = mysql_connect($localhost ,$dbuser ,$dbpass);
mysql_select_db($dbname, $connect);
现在,虽然我想更新我使用的特定行
session_start();
$username = $_SESSION['var']; //acutally users are logged so I just need to add their email
$email = $_POST['email']; //value I got from an inputbox
UPDATE users
SET email='google@gmail.com';
WHERE username='billy';
这不起作用,我也尝试过
$sql = "UPDATE 'users' SET 'email' = '$email' WHERE 'username' = '$username'";
mysql_query($sql);
此外,电子邮件的默认值设置为“ not added
”