Wednesday 7 June 2017

How to iterate through particluar fields of an object using node.js

I'm trying to iterate through an object "rows" like so-

for (var i = 1; i < 6; i++)
                {
                    if(rows[i]==null)
                    {
                        console.log("update DonateTo set CauseId"+i+" = "+id);
                        connection.query("update DonateTo set CauseId"+i+" = "+id);
                    }    
                }

where "rows" is an object which is a row of table from my MySQL Database containing 6 fields.

I want to iterate through 2nd to 5th fields.



via Ishaan Shakunt

No comments:

Post a Comment