0
    echo $t1, $t2, $t3, $t4, $uid;
$querytotal = "update customer_det set `t1` = $t1, `t2` = $t2, `t3` = $t3, `t4` = $t4 WHERE `id` = $uid "; 
echo $querytotal;

所以我回显了变量,我看到它们很好。当我去执行更新语句并在之后回显该语句时,它会删除所有变量。我不知道这怎么可能。t2Mysql_error: ...对于在第 1 行的 ' = , t3= , t4= WHERE ='附近使用正确的语法id。所以它在 t1 上跳过错误,但在 t2 时踢出?我在这里缺少什么吗?

这是运行前的回显查询update customer_det sett1 = '215',t2 = '240',t3 = '265',t4 = '300' WHEREid= '273'

update customer_det sett1 = '',t2 = '',t3 = '',t4 = '' WHEREid之后= ''

4

3 回答 3

0
echo $t1, $t2, $t3, $t4, $uid;
$querytotal = "update customer_det set t1 = '$t1', t2 = '$t2', t3 = '$t3', t4 = '$t4' WHERE id = '$uid' "; 
echo $querytotal;

您需要在 php 中的“双引号”内的变量名周围加上“单引号”,以便它们显示

于 2012-11-01T15:15:11.550 回答
0

尝试这个

回声$t1,$t2,$t3,$t4,$uid;$querytotal = "更新 customer_det 设置 t1 = '"。$t1 ."', t2 = '"。$t2 ."', t3 = '"。$t3 ."', t4 = '"。$t4 ."' 哪里 id = "。$uid; 回声$查询总计;

于 2013-06-05T16:36:07.200 回答
0

试试这个代码:

echo $t1, $t2, $t3, $t4, $uid;
$querytotal = "update customer_det set t1 = '{$t1}', t2 = '{$t2}', t3 = '{$t3}', t4 = '{$t4}' WHERE id = {$uid}"; 
echo $querytotal;

变量不会被删除。您的查询不正确。

于 2012-11-02T01:58:21.793 回答