Voici mon probléme, je voudrais retourner la variable
$e se trouvant dans ma class, dans le flux index.php:index.php:
<!DOCTYPE html>
<?php
include('process/process_weather.php')
?>
<head>
process_weather.php:
<?php
include('../class/Weather.php');
if(isset($_POST['submitChoiceCity'])){
$weather=new Weather;
$weather->publishWeather($_POST['choiceCity']);
}
Weather.php
public function publishWeather($city){
try
{
$bdd=new PDO('mysql:host=localhost;dbname=weather','root','');
}
catch(Exception $e)
{
die('Erreur :'.$e->getMessage());
}
$req1=$bdd->prepare('SELECT resumeColumn, period, tempMini, tempMaxi, comment FROM weathertable WHERE city=:city AND day=1');
$req1->execute(array(
'city'=>$city,
));
while($result=$req1->fetch()){
$e= '<p>'.$this->getNextDay(1).$city.' ; '.$result['period'].' ; '.$result['resumeColumn'].' ; '.$result['tempMini'].' ; '.$result['tempMaxi'].' ; '.$result['comment'].'</p>';
return $e;
}
$req1->closeCursor();
Voila, donc j'ai tester plusieurs façon mais sans succés...en sachant que la variable affiche bien quelque chose (j'ai tester avec un echo)...Cordialement