gpt4 book ai didi

php - 您的 SQL 语法有错误;检查与您的 MariaDB 服务器对应的手册

转载 作者:行者123 更新时间:2023-11-29 20:53:08 26 4
gpt4 key购买 nike

我有这个代码:

ANZ=`mysql -u $USER -p$PASSWD -h$HOST -D $DATABASE -e "SELECT count(id) FROM $TABLE WHERE deleted=1 and not lastname='anonym';" --skip-column-names -B;`;
if [ $((ANZ)) -gt 0 ]
then
mysql -u $USER -p$PASSWD -h$HOST -D $DATABASE -e "SELECT id, username FROM $TABLE WHERE deleted=1 and not lastname='anonym' and username like '%@%';" --skip-column-names -B > $FILE;

cat $FILE | while read TMP

do
echo "temp:" ${TMP% *};

UserID=${TMP% *};
echo $UserID >> $RES_FILE;

echo "User $UserID wird anonymisiert...";
echo $UserID;

echo '`mysql -u$USER -p$PASSWD -h$HOST -D $DATABASE -e "UPDATE $TABLE SET username="'$A$UserID'", email='a@nonym.de', firstname='$A', lastname='$A', icq='', skype='', yahoo='', aim='', msn='', phone1='', phone2='', institution='', dep$
echo' `mysql -u $USER -p$PASSWD -h$HOST -D $DATABASE -e "UPDATE mdl_message SET subject='Neue Mitteilung von anonym' WHERE useridfrom=$UserID;"`';
echo' `mysql -u $USER -p$PASSWD -h$HOST -D $DATABASE -e "UPDATE mdl_message_read SET subject='Neue Mitteilung von anonym' WHERE useridfrom=$UserID;"`';
VNAME=`mysql -N -u $USER -p$PASSWD -h$HOST -D $DATABASE -e "SELECT firstname FROM $TABLE WHERE id=$UserID;"`;
NNAME=`mysql -N -u $USER -p$PASSWD -h$HOST -D $DATABASE -e "SELECT lastname FROM $TABLE WHERE id=$UserID;"`;
`mysql -u $USER -p$PASSWD -h$HOST -D $DATABASE -e "UPDATE mdl_event SET name='Meeting with your Student, anonym' WHERE name LIKE 'Meeting with your Student,%$VNAME $NNAME%';"`;

done
echo
"Finish!"

我得到的错误是:

mysql -u$USER -p$PASSWD -h$HOST -D $DATABASE -e "UPDATE $TABLE SET username="anonym611 demo@XXXXX.de.1456411291", email=a@nonym.de, firstname=anonym, lastname=anonym, icq=, skype=, yahoo=, aim=, msn=, phone1=, phone2=, institution=, department=, address=, city=, country=, url= WHERE deleted=1 AND id=611 demo@XXXXX.de.1456411291;" ./anonym.sh: Zeile 50: echo
mysql -u $USER -p$PASSWD -h$HOST -D $DATABASE -e "UPDATE mdl_message SET subject=Neue: command not found. ./anonym.sh: Zeile 52: echo `mysql -u $USER -p$PASSWD -h$HOST -D $DATABASE -e "UPDATE mdl_message_read SET subject=Neue: command not found.

ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'demo@xxxxxxx.de.1456411291' at line 1

ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'demo@xxxxxxxxxx.de.1456411291' at line 1

最佳答案

您不能在带引号的字符串中使用 Quirles。使用单引号或用反斜杠转义

="anonym611 demo@XXXXX.de.1456411291"

关于php - 您的 SQL 语法有错误;检查与您的 MariaDB 服务器对应的手册,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37855333/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com