MySQL Error 1064: You have an error in your SQL syntax near

Avatar
  • Answered
I got this error

> You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?, a.ip_description = ? WHERE b.id_ip_address = a.id_ip_address AND b.id_server =' at line 1

Here are my code

session_start();

include ('../connect.php');
$member_id = $_SESSION["id"];

$url = $_POST["url"]; //varchar
$list_ip_address = $_POST["list_ip_address"]; //int
$ip_description = $_POST["ip_description"]; //varchar
$dns_list = $_POST["dns_list"]; //int

$sql = "UPDATE virtual_server SET id_ip_address = ?, url = ? WHERE id_server = $member_id";
//This part right here is fine
$stsql = $mysqli->prepare($sql);
$stsql->bind_param('is', $list_ip_address, $url);

if ($stsql->execute()) {
$ip = "UPDATE list_ip_address a, virtual_server b SET a.id_dns = ?, a.ip_description = ?
WHERE b.id_ip_address = a.id_ip_address AND b.id_server = $member_id";
$stip = $mysqli->prepare($ip);
$stip->bind_param('is', $dns_list, $ip_description);
$stip->execute();
}

Avatar
johnpaulb-imhs1
Hello, Thank you for your contacting us about an MySQL Error 1064: You have an error in your SQL syntax. As a test, try running the query in PHPmyAdmin, with actual data in place of the question marks '?'. If you have any further questions, feel free to post them below. Thank you, John-Paul