Wednesday, 20 May 2020

MySql issue with reading results

Hey all - I'm a bit new to JS in Node and I've hit a wall with an issue I'm having with querying MySQL. I've got a simple query and ultimately I just want to know if one or more rows is returned. This is my code:con.query(SomeSql, function (err, rows, fields){if (err) throw err;console.log(rows.length);rowCount = rows.length;......When this code is executed it logs the rows.length value in the console just fine but when it gets to the second line, it blows chunks saying TypeError: Cannot read property 'length' of undefinedI have had zero luck finding any resources about this online... what am i doing wrong?

Submitted May 20, 2020 at 01:26PM by huisek

No comments:

Post a Comment