Portée de variables avec require_once
bonjour à tous,
j'ai un script qui fait un accès à une base de données
vu les erreurs, l doit y avoir un souci dans le require_once:
Citation:
Notice: Undefined variable: hote in /opt/lampp/htdocs/tests/me_s_art (restructuré) 1/includes/modele/pictures.php on line 7
Notice: Undefined variable: login in /opt/lampp/htdocs/tests/me_s_art (restructuré) 1/includes/modele/pictures.php on line 7
Notice: Undefined variable: pass in /opt/lampp/htdocs/tests/me_s_art (restructuré) 1/includes/modele/pictures.php on line 7
Notice: Undefined variable: bd in /opt/lampp/htdocs/tests/me_s_art (restructuré) 1/includes/modele/pictures.php on line 8
Notice: Undefined variable: bd in /opt/lampp/htdocs/tests/me_s_art (restructuré) 1/includes/modele/pictures.php on line 8
erreur d'acces a la base :
voici mes fichiers:
pictures.php
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
| <?php
require_once ("includes/modele/config_sql.php");
function pictures_gen ($n) {
$link = mysqli_connect ($hote, $login, $pass) or die ("erreur de connexion :" . mysqli_error($link));
mysqli_select_db ($link, $bd) or die ("erreur d'acces a la base :" . $bd);
$_SESSION['titre'] = mysqli_query ($link, "SELECT titre FROM OEUVRE WHERE id_oeuvre = '$n' ");
$_SESSION['date'] = mysqli_query ($link, "SELECT date FROM OEUVRE WHERE id_oeuvre = '$n' ");
$_SESSION['chemin'] = mysqli_query ($link, "SELECT chemin FROM OEUVRE WHERE id_oeuvre = '$n' ");
$_SESSION['explication'] = mysqli_query ($link, "SELECT explication FROM OEUVRE WHERE id_oeuvre = '$n' ");
$_SESSION['titre'] = mysqli_query ($link, "SELECT titre FROM OEUVRE WHERE id_oeuvre = '$n' ");
$_SESSION['titre'] = mysqli_query ($link, "SELECT titre FROM OEUVRE WHERE id_oeuvre = '$n' ");
}
function pictures_dos ($n) {
$link = mysqli_connect ($hote, $login, $pass) or die ("erreur de connexion :" . mysqli_error($link));
mysqli_select_db ($link, $bd) or die ("erreur d'acces a la base :" . $bd);
$_SESSION['titre'] = mysqli_query ($link, "SELECT titre FROM OEUVRE WHERE id_oeuvre = '$n' ");
$_SESSION['date'] = mysqli_query ($link, "SELECT date FROM OEUVRE WHERE id_oeuvre = '$n' ");
$_SESSION['chemin'] = mysqli_query ($link, "SELECT chemin FROM OEUVRE WHERE id_oeuvre = '$n' ");
$_SESSION['explication'] = mysqli_query ($link, "SELECT explication FROM OEUVRE WHERE id_oeuvre = '$n' ");
$_SESSION['pre'] = mysqli_query ($link, "SELECT pre FROM OEUVRE WHERE id_oeuvre = '$n' ");
$_SESSION['liste'] = mysqli_query ($link, "SELECT liste FROM OEUVRE WHERE id_oeuvre = '$n' ");
}
?> |
config_sql.php
Code:
1 2 3 4 5 6
| <?php
$hote = "localhost";
$login = "config_sql";
$pass = "grout";
$bd = "WEBSITE";
?> |