Stackhero-MYSql - Query not working

Hi everyone,

I have a very strange problem with the Stackhero-MySQL-Node.

When I pass the query using a simple inject node, it works and I get this reply from the server:

{"_msgid":"d855ae7a356ff9bc","topic":"SELECT `ID`,`Vorname`,`Nachname` FROM `Users` WHERE `Karte`='8054EE72598B04' ","payload":[{"ID":916,"Vorname":"Nico","Nachname":"1234ABC"}]}

Since I want the Query to be dynamic I wrote this function:

var CardID=flow.get("UserCardID"||0);
if(CardID == 0){
    msg.error= "No Valid Card-ID!!"
    return msg;

msg.topic = 'SELECT `ID`,`Vorname`,`Nachname` FROM `Users` WHERE `Karte`='
msg.topic = msg.topic + "'";
msg.topic = msg.topic + CardID;
msg.topic = msg.topic + "' ";
delete msg.payload;
delete msg.port;

return msg;

The Query gets processed but I receive an empty array for msg.payload as output:

{"_msgid":"5925c8104e02c839","topic":"SELECT `ID`,`Vorname`,`Nachname` FROM `Users` WHERE `Karte`='8054EE72598B4' ","payload":[]}

I really can´t tell what I am doing wrong. To me both query look the same. I am sitting over this for more than an hour right now :sweat_smile:

....98B04 vs ....98B4

1 Like

Thank you, I guess I got blind while sitting over it for too long :smiley:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.