PHP MYSQL更新 - 替换整个单词,但不是它的一部分

时间:2015-11-04 16:21:12

标签: php mysql mysqli

可以说字段名称为bla,值为123

当我这样做时:

mysqli_query($con, "UPDATE table SET bla = REPLACE (bla, 123, 777)");

123变为777并且它很好

但是当我这样做时:

mysqli_query($con, "UPDATE table SET bla = REPLACE (bla, 1, 777)");

我不希望123成为77723但是留下123

我该怎么做?

1 个答案:

答案 0 :(得分:4)

为什么在没有int main(int argc, char *argv[]) { char *hexstring = "08fc0021"; unsigned long hexnumber = 0u; unsigned short a = 0u; unsigned short b = 0u; /* Use sscanf() to convert the string to integer */ sscanf(hexstring, "%x", &hexnumber); /* Use bitwise and to filter out the two higher bytes * * and shift it 16 bits right */ a = ((hexnumber & 0xFFFF0000u) >> 16u); /* Use bitwise AND to filter out the two lower bytes */ b = (hexnumber & 0x0000FFFFu); printf("0x%X 0x%X\n",a,b); return 0; } 子句的情况下使用REPLACE?出了什么问题:

WHERE