this is more a puzzle than a required fix to a problem, I've solved the problem I think.
what I don't understand is why I didn't get an error and why it behaved the way it did.
Basically I have a sub which is passed a form it takes the data and inserts a new record into SQL.
Simple enough, the update SQL routine I hand rolled and you call it like this...
prety basic really, the thing is i'd made a typo and forgot to put the & in front so it was ...
When the code ran, sometimes you'd submit the form and when the page refreshed it had inserted 2 records (a duplicate).
It didn't happen everytime but quite a lot and it took me ages to finally find the problem as I just couldn't see the missing &
I'm puzzled, why did the script not error? i'm used to calling subs by putting an & infront, but obviously it works without the & but why was it sometimes inserting 2 records.
what does 'subname(vars)' do different to '&subname(vars)'
can anyone shed some light on this please.
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
what I don't understand is why I didn't get an error and why it behaved the way it did.
Basically I have a sub which is passed a form it takes the data and inserts a new record into SQL.
Simple enough, the update SQL routine I hand rolled and you call it like this...
Code:
my $rec = &insSQL("Table","Column1,Column2,Column3","'Value1','Value2','Value3'");
prety basic really, the thing is i'd made a typo and forgot to put the & in front so it was ...
Code:
my $rec = insSQL("Table","Column1,Column2,Column3","'Value1','Value2','Value3'");
When the code ran, sometimes you'd submit the form and when the page refreshed it had inserted 2 records (a duplicate).
It didn't happen everytime but quite a lot and it took me ages to finally find the problem as I just couldn't see the missing &
I'm puzzled, why did the script not error? i'm used to calling subs by putting an & infront, but obviously it works without the & but why was it sometimes inserting 2 records.
what does 'subname(vars)' do different to '&subname(vars)'
can anyone shed some light on this please.
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.