я пытаюсь запустить этот SQL запрос в PHP:PHP SQL Update Query неудачу
UPDATE
billing_calldata
SET
status = 'c',
customer = '475',
description = 'UK Mobile VMNO C&W (fw7-C&W)',
customer_cost = '0.00720416666666667',
customer_ac = '0',
customer_sc = '0',
reseller_cost = '0',
reseller_ac = '0',
reseller_sc = '0'
ГДЕ последовательность = 10364723
, но она возвращается сообщение об ошибке:
UPDATE
billing_calldata
SET
status = 'c',
customer = '475',
description = 'UK Mobile VMNO CYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''UK Mobile VMNO C' at line 1
description
является UK Mobile VMNO C&W (fw7-C&W)
Но q uery отлично работает непосредственно в phpMyAdmin
запрос происходящий из моей vb.net приложения:
SQL = "UPDATE billing_calldata SET " _
& "status = 'c', " _
& "customer = '" & customer_sequence & "', " _
& "description = '" & description & "', " _
& "customer_cost = '" & customer_cost & "', " _
& "customer_ac = '" & customer_ac & "', " _
& "customer_sc = '" & customer_sc & "', " _
& "reseller_cost = '" & reseller_cost & "', " _
& "reseller_ac = '" & reseller_ac & "', " _
& "reseller_sc = '" & reseller_sc & "' " _
& "WHERE sequence = " & sequence & " "
SQL = "apikey=1nt3gr4&submittedSQL=" + SQL
тогда я отправить это в запросе сообщение на PHP страницу, которая содержит следующее:
if($_POST["apikey"] <> '' and $_POST["apikey"] == '1nt3gr4' and $_POST["submittedSQL"] <> '') {
$sql = $_POST["submittedSQL"];
mysql_query($sql, $conn) or die(mysql_error());
}
Пожалуйста, разместите полные строки кодирования вашего php и сообщите нам структуру таблицы. – etalon11
Читайте об экранировании специальных символов в 'PHP' – sagi