Kinnard Hockenhull wrote
> var r = [];
>>
>> for (g in req.body)
>> {
>> r[g]=req.body[g];
>> console.log('r[g] is ' + r[g]);
>> }
>>
>> client = pg.connect(connectionString, function(err, client, done){
>> if(err) console.log(err);
>> client.query('INSERT INTO causes (cause_name, goal, organization,
>> sponsor, submitter) VALUES ($1,$2,$3,$4,$5)', r, function(err){
>> console.log('This is r' + r)
>> if (err) console.log(err);
>> });
>> });
>> });
>>
>> Is this a scope issue? I tried passing r into pg.connect, that didn't
>> work.
>>
Apparently not many Node.js users on these lists...
Since you are logging lots of stuff to the console you should provide that
information as well. The client.query(...) code looks correct syntactically
but if "r" does not have exactly (at least?) 5 values in the array the query
execution will fail. You have not shown us what is in "r" at the time
client.query(...) is executed.
David J.
--
View this message in context:
http://postgresql.1045698.n5.nabble.com/error-there-is-no-parameter-1-tp5774552p5774955.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.