Précédent   Forum des professionnels en informatique > PHP > Langage > Fonctions
Fonctions Forum d'entraide sur les fonctions PHP. Avant de poster -> FAQ fonctions et Sources diverses
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 19/09/2011, 13h58   #1
Invité régulier
 
gdgfs thomas
Inscription : juillet 2010
Messages : 19
Détails du profil
Informations personnelles :
Nom : gdgfs thomas

Informations forums :
Inscription : juillet 2010
Messages : 19
Points : 5
Points : 5
Par défaut bool(false) variable vide

Bonjour

j'ai modifier un script et un problème est survenue , la variable var_dump($datat); me retourne ceci

Citation:
array(8) { [0]=> string(2) "66" ["id_sea"]=> string(2) "66" [1]=> string(1) "3" ["id_cat"]=> string(1) "3" [2]=> string(6) "KM max" ["sel_nom"]=> string(6) "KM max" [3]=> string(12) "Kilométrage" ["champ"]=> string(12) "Kilométrage" }

Année-Modèle :
bool(false) <-------------- c'est ici que la variable est vide !!!

Energie :
array(8) { [0]=> string(3) "190" ["id_sea"]=> string(3) "190" [1]=> string(1) "2" ["id_cat"]=> string(1) "2" [2]=> string(7) "Energie" ["sel_nom"]=> string(7) "Energie" [3]=> string(7) "Energie" ["champ"]=> string(7) "Energie" }

Boite :
array(8) { [0]=> string(3) "189" ["id_sea"]=> string(3) "189" [1]=> string(1) "2" ["id_cat"]=> string(1) "2" [2]=> string(16) "Boite de vitesse" ["sel_nom"]=> string(16) "Boite de vitesse" [3]=> string(5) "Boite" ["champ"]=> string(5) "Boite" }
Voici mon code :
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
53
54
55
56
57
58
59
60
61
<?php
function display_noms($array)
{
   foreach ($array as $row)
   {
      $id= htmlspecialchars($row['id_for'], ENT_QUOTES);   
 
      $form_name = "form".$id;
 
      if (!empty($_SESSION[$form_name]))
      {
         $value = stripslashes(htmlspecialchars($_SESSION[$form_name], ENT_QUOTES));
      }
      else $value = '';
 
      $name = stripslashes(htmlspecialchars($row['nom_for'], ENT_QUOTES));
      $uni= stripslashes(htmlspecialchars($row['uni_for'], ENT_QUOTES));
 
      echo '<p class="form_left">';
 
      if (isset($_SESSION['error'][''. $form_name .'']))
         echo '<span class="error">';
 
      echo '<label for="'. $name .'">'. $name .' :</label>';
 
      if (isset($_SESSION['error'][''. $form_name .'']))
         echo '</span>';
 
      echo '</p>';
 
              $sqlconnect = "SELECT * FROM search WHERE champ='$name'";
$reqconnect = mysql_query($sqlconnect) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$datat = mysql_fetch_array($reqconnect);
 
                  $rrr = $datat["sel_nom"];
                  if($rrr == 'Année-Modèle')
                  {$rrr="Année-Modèle min";}
                  var_dump($rrr);
                   ?>
<p class="form_right_select">
              <label for="<?php echo"$name"; ?>"></label>
                <select name="<?php echo"$name"; ?>" id="<?php echo"$name"; ?>" class="av_input">
<?php
               $sqlconnect1 = "SELECT * FROM select_valeurs WHERE sel_nom='$rrr'";
$reqconnect1 = mysql_query($sqlconnect1) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
 
          while($dataw = mysql_fetch_array($reqconnect1))
{
                              $valeur = $dataw["valeur"];
 
            echo"<option value=\"$valeur\">$valeur</option>
";}
         ?>
             </select>
            <span class="info_form"> </span>
         </p>
<?php
   /*    echo '
            <input type="text" id="'. $name .'" class="av_input" name="'. $form_name .'" value="'. $value .'" /> &nbsp;<span class="info_form">'. $uni .''; */
   }   
}

J'ai chercher longtemps d’où le problème pourrait venir mais j'ai pas trouver ... le truc est bizarre ....

Je vous remercie de votre futur aide
thomix68 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/09/2011, 11h18   #2
Modératrice
 
Avatar de Celira
 
Femme
Développeuse PHP/Java
Inscription : avril 2007
Messages : 3 661
Détails du profil
Informations personnelles :
Sexe : Femme
Âge : 27
Localisation : France

Informations professionnelles :
Activité : Développeuse PHP/Java

Informations forums :
Inscription : avril 2007
Messages : 3 661
Points : 5 388
Points : 5 388
Honnêtement, j'ai pas compris la question
Où cette variable est-elle définie ? où est-elle affichée ? et que t'attendais-tu à avoir dedans ?
__________________
Modératrice PHP
Aucun navigateur ne propose d'extension boule-de-cristal : postez votre code et vos messages d'erreurs. (Rappel : "ça ne marche pas" n'est pas un message d'erreur)

Pour afficher votre code en couleurs : [CODE=php][/CODE] (bouton # de l'éditeur)
Celira est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/09/2011, 12h12   #3
Membre régulier
 
Avatar de daheda
 
Homme Dah Andri.
Développeur Web
Inscription : août 2006
Messages : 79
Détails du profil
Informations personnelles :
Nom : Homme Dah Andri.
Localisation : Ile Maurice

Informations professionnelles :
Activité : Développeur Web

Informations forums :
Inscription : août 2006
Messages : 79
Points : 77
Points : 77
Envoyer un message via Yahoo à daheda Envoyer un message via Skype™ à daheda
à constater ce que tu as envoyé, peut être que je me trompe, le var_dump était fait sur $datat et si c'est le cas c'est que la requête n'a retourné aucun resultat. vue que var_dump($rrr); est sensé être un string.
daheda est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 03h16.


 
 
 
 
Partenaires

Hébergement Web