mysql - How do I correctly redirect after update in PHP -


the table seems update, not redirect me main page. have try different things no luck. if can me. thans in advance. put update code only, if there need put complete code of page will.

$id_actividades = $_get['idactividades'];  include('../includes/eamoschema.php');   $stmt = $dbh->prepare("select * actividades idactividades=:id_actividades");  $stmt -> bindparam(':id_actividades', $id_actividades);   $stmt->execute();       $result = $stmt->fetchall(pdo::fetch_assoc);        if($_server['request_method']== 'post'){ if (isset($_post['tname']) || isset($_post['place']) || isset($_post['organizer']) || isset($_post['from']) || isset($_post['to']) ) {      $tname = $_post['tname'];   $place = $_post['place']; $organizer = $_post['organizer']; $from = $_post['from'];     $to = $_post['to'];      try{              $stmt = $dbh->prepare("update guaynabodb.actividades set ntorneo = :n_torneo, ltorneo = :l_torneo, otorneo = :o_torneo, fecha_inicial = :from, fecha_final = :to idactividades=:id_actividades");  $stmt -> bindparam(':n_torneo', $tname);   $stmt -> bindparam(':l_torneo', $place);    $stmt -> bindparam(':o_torneo', $organizer);     $stmt -> bindparam(':from', $from);      $stmt -> bindparam(':to', $to);      $stmt -> bindparam(':id_actividades', $id_actividades);    $stmt->execute();    }  catch (pdoexception $ex) {   $_session['errorcode3'] =$ex->getmessage();  header('location: actividades.php?errorcode=3');//to redirect  exit;  }  header('location:actividades.php');//to redirect   exit; }   } 

your biggest , foremost problem lack of error reporting.

it spoils not in particular case whole experience php.
every time when goes wrong, php tell - happened , whom blame. if let it. don't.

on live site have peek error logs, so, have configure php way:

error_reporting(e_all); ini_set('display_errors',0); ini_set('log_errors',1); 

while on local development server it's right make errors on screen:

error_reporting(e_all); ini_set('display_errors',1); 

as have error, know do: search text on google. find answer immediately, it's popular php error message ever.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -