par
Incognito » 17 avr. 2015, 11:22
Bonjour,
Voici mon problème, je créée un select :
<select name="selHotel">
<?php
$db=new PDO ('mysql:host=localhost;dbname=hotels_booking','root','');
$req=$db->prepare('SELECT name_hotels FROM hotels');
$req->execute();
while ($row=$req->fetch()){
echo "<option value=".$row["name_hotels"].">".$row["name_hotels"]."</option>";
}
?>
</select>
Tout s'affiche comme il faut, ensuite l'enregistrement se fait dans la base de données...mais le nom de mon hôtel (par exemple :"Le Palace") est coupé à "Le"...ceci pour tous mes noms d’hôtels...
J'effectue un var_dump lors de mon enregistrement :
object(Booking)[5]
protected '_id' => null
protected '_name' => string 'pol' (length=3)
protected '_email' => string '
[email protected]' (length=10)
protected '_hotel' => string 'Le' (length=2)
protected '_dtBegin' => string '2015-09-09' (length=10)
protected '_dtEnd' => string '2015-10-09' (length=10)
protected '_dtCreation' => string '2015-04-17' (length=10)
Donc, au final, dans ma base de données je n'enregistre que "Le"...
Si quelqu'un peut m'aider...d'avance merci...
Bonjour,
Voici mon problème, je créée un select :
[php]<select name="selHotel">
<?php
$db=new PDO ('mysql:host=localhost;dbname=hotels_booking','root','');
$req=$db->prepare('SELECT name_hotels FROM hotels');
$req->execute();
while ($row=$req->fetch()){
echo "<option value=".$row["name_hotels"].">".$row["name_hotels"]."</option>";
}
?>
</select>[/php]
Tout s'affiche comme il faut, ensuite l'enregistrement se fait dans la base de données...mais le nom de mon hôtel (par exemple :"Le Palace") est coupé à "Le"...ceci pour tous mes noms d’hôtels...
J'effectue un var_dump lors de mon enregistrement :
object(Booking)[5]
protected '_id' => null
protected '_name' => string 'pol' (length=3)
protected '_email' => string '
[email protected]' (length=10)
[color=#FF0000] protected '_hotel' => string 'Le' (length=2)[/color]
protected '_dtBegin' => string '2015-09-09' (length=10)
protected '_dtEnd' => string '2015-10-09' (length=10)
protected '_dtCreation' => string '2015-04-17' (length=10)
Donc, au final, dans ma base de données je n'enregistre que "Le"...
Si quelqu'un peut m'aider...d'avance merci...