I am setting up a form that allows people to register as an affiliate to other member's in the database.
If the member institution has paid, then the affiliate member's expired is set to 2, if the institution is unpaid, the affiliate member's expired is 4.
I am confused on how to do the if else....any help is greatly appreciated.
the function starts as...
function registeraff($billEmail,$institutioncontact,$passwd,$dateadded,$dateupdated,
$secretquestion,$secretanswer,$fname,$mname,$lname,$title,$institutionname,
$departmentname,$street,$street2,$city,$state,$zip,$country,$phone,$faxphone,
$alternatephone,$affiliateinfo,$institutioninfo,$institutionsize,$website,$phonetocall,
$timetocall,$paymentmethod,$paidflag,expired)
{
// connect to db
$conn = db_connect();
if (!$conn)
return 'Could not connect to database server - please try later.';
// check if email is unique
$emailresult = mysql_query("select * from users_tbl
where bill_email='$billEmail'");
if (!$emailresult)
return 'Could not execute query';
if (mysql_num_rows($emailresult)>0)
return 'That username is taken - go back and choose another one.';
// check if institution is unpaid
$paidresult = mysql_query("select * from users_tbl
where institutioname ='$institutionname' AND paidflag = '1'");
if (!$paidresult)
return 'Could not execute query';
if (mysql_num_rows($paidresult)>0)
paidflag = 1 is an unpaid institution, so their insert statement would be
$unpaid = mysql_query("insert into users_tbl values ('$billEmail','$institutioncontact',password('$passwd'),NOW(),'$dateupdated',
'$secretquestion','$secretanswer','$fname','$mname','$lname','$title','$institutionname',
'$departmentname','$street','$street2','$city','$state','$zip','$country','$phone','$faxphone',
'$alternatephone','$affilitateinfo','$institutioninfo','$institutionsize','$website','$phonetocall','$timetocall',
'$paymentmethod',1,4)");
if (!$unpaid)
return 'Could not register you in database - please try again later.';
if paidflag <1 then
$paid = mysql_query("insert into users_tbl values ('$billEmail','$institutioncontact',password('$passwd'),NOW(),'$dateupdated',
'$secretquestion','$secretanswer','$fname','$mname','$lname','$title','$institutionname',
'$departmentname','$street','$street2','$city','$state','$zip','$country','$phone','$faxphone',
'$alternatephone','$affilitateinfo','$institutioninfo','$institutionsize','$website','$phonetocall','$timetocall',
'$paymentmethod',0,2)");
if (!$paid)
return 'Could not register you in database - please try again later.';
then, if they register as either paid or unpaid then I need to let it know to go to the next step
return true;
}