mysql - Php does not execute sql query and time out -


i'm trying delete rows of 'occupation_data' (table) there foreign constraint, did small php script delete data linked in others tables , after delete in occupation_data.

when run script see loading in browser nothing appear, tools should use debug this?

thank you

goldiman

here code:

<?php error_reporting(e_all); set_time_limit(60000); // there more 30 tables , 380 primary key delete, may take time ini_set("display_errors", 1);   $tupleasup = array(     '13-1199.05',     '13-1023.00',     '13-1022.00',     '53-6031.00' ); //contain primary key of row   $table = array(     'abilities',     'education_training_experience',     'green_occupations',     'occupation_data' );  try {     $valeur_hote         = '**********';     $valeur_port         = '******';     $valeur_nom_bd       = '********';     $valeur_user         = '*******';     $valeur_mot_de_passe = '*******'; //working connection setting      $connexion = new pdo('mysql:host=' . $valeur_hote . ';port=' . $valeur_port . ';dbname=' . $valeur_nom_bd, $valeur_user, $valeur_mot_de_passe);     $connexion->exec("set names 'utf8'");     $connexion->setattribute(pdo::attr_errmode, pdo::errmode_exception);      echo "toto"; // message not displayed      foreach ($tupleasup $codeonet) {          foreach ($table $nomtable) {             $query     = "delete " . $nomtable . " onetsoc_code =" . $codeonet;             $resultats = $connexion->query($query);         }         echo "supprimé" . $codeonet; // message not displayed too.      } } catch (pdoexception $e) {     echo 'Échec lors de la connexion : ' . $e->getmessage(); }    ?> 

just debug , check if connection ok transform code to:

try {     $valeur_hote         = '**********';     $valeur_port         = '******';     $valeur_nom_bd       = '********';     $valeur_user         = '*******';     $valeur_mot_de_passe = '*******'; //working connection setting      $connexion = new pdo('mysql:host=' . $valeur_hote . ';port=' . $valeur_port . ';dbname=' . $valeur_nom_bd, $valeur_user, $valeur_mot_de_passe); } catch (pdoexception $e) {     echo 'Échec lors de la connexion : ' . $e->getmessage();     $connexion = false; }  if ($connexion != false) {   $connexion->exec("set names 'utf8'");   echo "toto"; // message not displayed   foreach ($tupleasup $codeonet) {      foreach ($table $nomtable) {         $query     = "delete `$nomtable` onetsoc_code = :code";         $sth = $connexion->prepare($query);         $sth->bindparam(':code',$codeonet);         if (! $sth->execute() ) {           $arr = $sth->errorinfo();           print_r($arr);         }     }     echo "supprimé" . $codeonet; // message not displayed too.  } 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -