$newInt = substr_replace($oldInt, $newDigit, $position, 1);
             $newValue = (string)$newInt;
            echo $newValue;


回声0000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
   (我想要的是!)

mysql_query("UPDATE table SET $fieldVariable = $newValue WHERE userID  = '".$_SESSION['userID']."' ")or die("Query failed:".mysql_error());


mysql记录显示
99999999999999999999999999999999999999999999999

mysql字段设置为varchar(100)

最佳答案

在$ newValue周围添加引号,因为它是VARCHAR字段

mysql_query("UPDATE table SET $fieldVariable = '$newValue' WHERE userID  = '".$_SESSION['userID']."' ")or die("Query failed:".mysql_error());

关于php - mysql之前的输出与Phpmyadmin中处理的更新不同,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8172981/

10-13 05:21