0

MySQL に INSERT INTO>

これは手順のコードの一部です。

if ParentList is null then

        set @sql=concat('insert into ', table_name, tabSave, '(md5Id, CommentsId, Parent, Content, UserId, Title, Nick) ',
        'values(', @md5Id, ', ', CommentsId, ', null, \'', Content, '\'' ,UserId,',',Title,',',Nick, ')');
else
    set @sql=concat('insert into ', table_name, tabSave, '(md5Id, CommentsId, Parent, Content, UserId, Title, Nick) ',
        'values(', @md5Id, ', ', CommentsId, ', ', @Parent, ', \'', Content, '\ ,', UserId,', ', Title,', ', Nick, ')');
end if;

この文字記号 ' が正しく挿入されておらず、どこにあるのかわかりません :

私のエラー:

CALL AddDynamicTable3('asd65xb', 'xxx', 5, NULL, 'MojWstep', 22, 'New title', 'Ethan')  Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '22,New title,Przemo)' at line 1

XXX - テーブル名

他の変数は重要ではありません例 tabSave、table_name ...

前に同じ手順を書きましたが、UserId、Title、Nick、およびその OK の 3 つの変数を使用していませんが、この変数を配置すると、ERROR しか表示されません。

4

1 に答える 1

0

これが機能するかどうかを確認します。

'\ ,', UserId,',

2 番目のクエリから、次のように変更します。

'\ ', UserId,',
于 2012-07-25T12:47:28.703 に答える