if ifadesi OOP

1 Cevap

Ben aşağıdaki kodu var

/* Errors exist, have user correct them */
  if($form->num_errors > 0)
  {
     return 1;  //Errors with form
  }
  /* No errors, add the new account to the */
    else if($database->addLeagueInformation($subname, $subformat, $subgame, $subseason, $subwindow, $subadmin, $subchampion, $subtype))
    {
        return 0;  //New user added succesfully
    }
    else
    {
    return 2;  //Registration attempt failed
    }

Ben ona şu eklemek istediğiniz

$databases->addLeagueTable($name)

This should happen at the same time as addLeagueInformation. Any ideas?

Düzenlendi, bu işe yarayacak mı?

else if($database->addLeagueInformation($subname, $subformat, $subgame, $subseason, $subwindow, $subadmin, $subchampion, $subtype)
                                            && $databases->addLeagueTable($name) && $_SESSION['players'] == $subplayers && $comp_name =     
                                            "$format_$game_$name_$season" && $_SESSION['comp_name'] = $comp_name)

1 Cevap

Gerçekten girinti ile tutarlı kalmak gerekir, okumak için kod çok daha kolay hale getirir.

Her neyse:

// Errors exist, have user correct them
if ($form->num_errors > 0)
{
    return 1;  // Errors with form
}
// No errors, add the new account to the
else if ($database->addLeagueInformation($subname, $subformat, $subgame, $subseason, $subwindow, $subadmin, $subchampion, $subtype)
    && $databases->addLeagueTable($name))
{
    return 0;  // New user added succesfully
}
else
{
    return 2;  // Registration attempt failed
}