looping sql statement

wxdqz

New Member
Hello,
I have mucked about with while and loop for ages, just can't work this out. The variables popentialy go up to '$num30' on the below statement. Surely there is a way get it to repeat itself rather than hard code it 30 times in order to account for all variables? P


$cQuery .=" IF (SELECT count(*) FROM contractplus WHERE account=$accselecta and num=$num1) = 0 ";
$cQuery .=" BEGIN ";
$cQuery .=" insert into contractplus (account, num, letterLateProof) ";
$cQuery .=" values ($accselecta,$num1,current_timestamp) ";
$cQuery .=" END ";
$cQuery .=" ELSE ";
$cQuery .=" update contractplus set letterLateProof = current_timestamp where account=$accselecta and num=$num1 ";
 
Back
Top