简体   繁体   中英

Updating Values in a row PHP/MySql

Im not very experienced with PHP so I don't fully understand the syntax of PHP or MySQL Ive tried to tweak my code to create a row to update a row. this is the my attempt to update the row.

$sql = "UPDATE  `" . $table . "`SET (Expire_Date, HWID, IP_ADDRESS, PC_NAME) VALUES (?,?,?,?);";
$stmt = mysqli_stmt_init($link);

if (!mysqli_stmt_prepare($stmt, $sql)) {
    echo " sql key_register function failed";
} else {
    mysqli_stmt_bind_param($stmt, "ssss", $exp_date, $hwid, $ipaddress, $pcname);
    mysqli_stmt_execute($stmt);
    echo "licence activated";
}

I think my issue is the SQL syntax, I could just expand the code out and make a big mess but I like doing it this way because it 'seems' tidy I guess. Could someone show me what I am doing incorrectly.

use correct UPDATE syntax:

$sql = "UPDATE  `" . $table . "`SET Expire_Date = ', HWID = ?, IP_ADDRESS = ?, PC_NAME = ?";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM