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;

So I echo the variables, and I see them fine. When I go to do the update statement and echo the statement afterwards, it drops all the variables. I have no idea how that's even possible. Mysql_error: ...for the right syntax to use near ' t2 = , t3 = , t4 = WHERE id =' at line 1. So it's skipping error on t1, but then kicks out at t2? Is there something i'm missing here?

Here's the echo'd query before it's ran update customer_det sett1= '215',t2= '240',t3= '265',t4= '300' WHEREid= '273'

and after 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;

変数はドロップされていません。あなたのクエリは正しくありません。

于 2012-11-02T01:58:21.793 に答える
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 に答える