Connexion à la base de données
Bonjour,
J'avais un code sur ma page d'accueil, qui fonctionnait a merveille.
Je sors cette brique de code pour la mettre dans un fichier a part et plus rien ne fonctionne.
Pour la connexion a la base je lui rajoute même un require pour mon bootstrap et rien n'y fait.
Voila mon include:
Code:
<?= $this->partial('./includes/recruteAgence.phtml'); ?>
Voilà la page en question:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| <?php
try {
require './application/bootstrap.php';
} catch (Exception $exception) {
echo '<html><body><center>'
. 'An exception occured while bootstrapping the application.';
mail('test@test.fr','An exception occured while bootstrapping the application',nl2br(htmlentities(print_r($exception,true))));
if (defined('APPLICATION_ENVIRONMENT')
&& APPLICATION_ENVIRONMENT != 'production'
) {
echo '<br /><br />' . $exception->getMessage() . '<br />'
. '<div align="left">Stack Trace:'
. '<pre>' . $exception->getTraceAsString() . '</pre></div>';
}
echo '</center></body></html>';
exit(1);
}
?>
<div class="title_block side-box last" style="padding-top: 0;"><h2 class="header-blue" style="text-align: center;color: #888">Les agences qui recrutent</h2></div>
<?php
$col[] = array_slice($this->postes,0,7);
$col[] = array_slice($this->postes,7,7);
print_r ($col);
$new_array = array();
foreach ($col as $co) {
print '<div style="width:45%;float: left; margin: 0 1% 0 1%;display: inline"><ul>';
foreach ($co as $poste) {
$key = $poste['cli_id']; /*** 30/08/2010 1 annonce par client **/
if(!isset($new_array[$key] )){ /*** 30/08/2010 1 annonce par client **/
$new_array[$key] = $poste['cli_id']; /*** 30/08/2010 1 annonce par client **/
$url_fiche_detail = $this->baseUrl() . '/index/fiche/id/' . $poste['poste_id'].'/'.str_replace('é','e',$poste['contrat_nom']).'/'.$poste['poste_intitule'];
//$url_lieu = $this->baseUrl() . '/index/recherche?cr=poste&loc='.$poste['agence_ville'];
print '<li onclick="window.location = \''.$url_fiche_detail.'\';" style="cursor: pointer">';
print '<a class="job_title" href="'.$url_fiche_detail.'">';
print $poste['poste_intitule'];
print '</a><br />';
print '<a class="job_place" href="'.$url_fiche_detail.'">';
print $poste['agence_ville'];
print '</a>';
print '<a class="job_place" style="padding: 0 .5em" href="'.$url_fiche_detail.'">';
print $poste['cli_rs'];
print '</a>';
print '</li>';
}
}
print '</ul></div>';
}
?>
<div class="clear"></div>
</div> |
Le print_r me renvoit
Code:
Array ( [0] => [1] => )
Si vous voyez d'ou ça peut venir. Merci
Mon bootstrap inclut mon config.ini qui contient les logs de connexion a la base de données.
Personne ne voit pourquoi je perds la connexion à la base de données quand je fais mon include??
Merci d'avance pour votre aide.