Ce n'est pas encore ça

Nouveau WRInaute
Bonjour

Tout au début mon script n’affichait rien, j’ai du change < ? ? > par < ? PHP ? > pour qu’il commence à m’affiché quelque chose, mais malheureusement se sont que des erreurs.
La basse de donnée est correctement créée.

Tout en haut de la page index j’ai ça
Code:
n"; $return .= "Tous les livres\n"; $return .= "\n"; // l'Ancien Testament if ($livre == "O") $isAT = "selected"; else $isAT = ""; $return .= "Ancien Testament\n"; $sql_selivre = mysql_db_query ($dbname2, "SELECT id, livre FROM ref_bible WHERE id LIKE '%O'", $connex_bible); while ($livres = mysql_fetch_object ($sql_selivre)) { if ($livre == $livres->id) $selected = "selected"; else $selected = ""; $return .= "id. "\" " . $selected . ">" .$livres->livre. "\n"; } $return .= "\n"; // le Nouveau Testament if ($livre == "N") $isNT = "selected"; else $isNT = ""; $return .= "Nouveau Testament\n"; $sql_selivre = mysql_db_query ($dbname2, "SELECT id, livre FROM ref_bible WHERE id LIKE '%N'", $connex_bible); while ($livres = mysql_fetch_object ($sql_selivre)) { if ($livre == $livres->id) $selected = "selected"; else $selected = ""; $return .= "id. "\" " . $selected . ">" .$livres->livre. "\n"; } $return .= "\n"; return $return; } ?>
Notice: Undefined index: LSG in C:\wamp\www\bible_php\bible.php on line 26

Notice: Undefined index: darby in C:\wamp\www\bible_php\bible.php on line 27

Notice: Undefined index: martin in C:\wamp\www\bible_php\bible.php on line 28

Notice: Undefined index: ostervald in C:\wamp\www\bible_php\bible.php on line 29
.......

......

Notice: Undefined variable: dbname2 in C:\wamp\www\bible_php\bible.php on line 66

Notice: Undefined variable: connex_bible in C:\wamp\www\bible_php\bible.php on line 66

Warning: mysql_db_query(): supplied argument is not a valid MySQL-Link resource in C:\wamp\www\bible_php\bible.php on line 66

Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in C:\wamp\www\bible_php\bible.php on line 67

Notice: Trying to get property of non-object in C:\wamp\www\bible_php\bible.php on line 68



voici la page index

Code:
<table width="100%" border="0">
  <tr>
    <td valign="top"><?php 
	include ("bible.php");
?></td>
    <td width="200" valign="top"><br />
      <br />
    <?php
	include ("menu.php");
?></td>
  </tr>
</table>


et la page bible.php

Code:
<?php

	$racine = "./";
	

	include ("config.inc.php");
	include ("includes/tradfrancais.inc.php");
	include ("includes/barre_navig.inc.php");
	include ("includes/gen_listechap.inc.php");
	include ("includes/gen_listeverses.inc.php");
	include ("includes/gen_listelivres.inc.php");

	
	$nb_paagesaff 	= 3; 	
	$nb_versets 	= 30; 	
	$nb_resultpp 	= 20;	
	
	$file_accueil 	= "livres.php";   

	$LSG 		= $_REQUEST["LSG"];
	$darby 		= $_REQUEST["darby"];
	$martin 	= $_REQUEST["martin"];
	$ostervald 	= $_REQUEST["ostervald"];
	$change_vst = $_REQUEST["change_vst"];
	$cookie_ok 	= $_REQUEST["cookie_ok"];
	$change_vst = $_REQUEST["change_vst"];
	$promesse 	= $_REQUEST["promesse"];
	$livre 		= $_REQUEST["livre"];
	$chapitre 	= $_REQUEST["chapitre"];
	$verset 	= $_REQUEST["verset"];
	$q 			= $_REQUEST["q"];
	$start		= $_REQUEST["start"];
	
 
	if (empty($action) || ($action == "recherche" && $q < 2)) $action = $_REQUEST["action"];
	if (empty($action)) $action = "accueil";
	if (empty($promesse) && $change_vst != 1) $promesse = $_REQUEST["promesse"]; 
	if (empty($LSG) && empty($darby) && empty($martin) && empty($ostervald)) $LSG = 1;

 
	if (!empty($promesse)) 	$larequete = "&promesse=" . $promesse;
	if (!empty($livre)) 	$larequete .= "&livre=" . $livre;
	if (!empty($chapitre)) 	$larequete .= "&chapitre=" . $chapitre;
	if (!empty($q)) 		$larequete .= "&q=" . urlencode($q);
	
	$larequete2 = $larequete . "&action=" . $action; ;
	
	if (!empty($LSG))		$larequete .= "&LSG=" . $LSG;
	if (!empty($darby))		$larequete .= "&darby=" . $darby;
	if (!empty($martin))	$larequete .= "&martin=" . $martin;
	if (!empty($ostervald))	$larequete .= "&ostervald=" . $ostervald;
	
 
	if ($LSG == 1)  		 $title = " Louis Segond";
	elseif ($darby == 1) 	 $title = " Darby";
	elseif ($martin == 1) 	 $title = " Martin";
	elseif ($ostervald == 1) $title = " Ostervald";
	
 
	$sql_titrelivre = mysql_db_query ($dbname2, "SELECT livre FROM ref_bible WHERE id='" . $livre . "'", $connex_bible);
	$titre_livre = mysql_fetch_object ($sql_titrelivre);
	$nom_livre = $titre_livre->livre;

	 
	if (empty($chapitre) && $action == "texte") $chapitre = 1;
	
	$q = str_replace('+', ' ', trim(stripslashes($q)));
	$q = str_replace(',', ' ', $q);
	$q = str_replace(':', ' ', $q);
	$q = str_replace('-', ' ', $q);
	$q = str_replace('\'', '`', $q);

	$tab_mc = explode(' ' , $q);

	
 

	if ($action == "accueil" || empty($action)) include ($file_accueil);

 

	elseif ($action == "recherche" && strlen($q) > 2 ) {
	
		if ($LSG == 1) 			 $traduction = "LSG";
		elseif ($darby == 1) 	 $traduction = "darby";
		elseif ($martin == 1) 	 $traduction = "martin";
		elseif ($ostervald == 1) $traduction = "ostervald";
			
	 
		$req_search = "SELECT id, ch, vst, $traduction FROM versets WHERE ";
		
		 
		$nb_mc = count ($tab_mc);
		
		if  ($nb_mc != 0) {
		
			$req_search .= " (";
			
			for ($i = 0; $i != $nb_mc; $i++) {
			
				if (strlen($tab_mc[$i]) > 2) {
				
					if ($promesse == 1) $LIAISON = " OR ";
					else $LIAISON = " AND ";
					
					$req_search .= " (" . $traduction . " LIKE '%" . trim(addslashes($tab_mc[$i])) . "%' OR
								   " . $traduction . " LIKE '%" . trim(addslashes(francais3($tab_mc[$i]))) . "%')";
					$req_search .= $LIAISON;
				}
			}
			$req_search = substr ($req_search, 0, -4);
			$req_search .= ") ";
		}
		
	 
		if (!empty($livre) && $livre != "O" && $livre != "N") $req_search .= " AND id='" . $livre . "'";
		
		 
		if (!empty($chapitre) && !empty($livre)) $req_search .= " AND ch='" . $chapitre . "'";
		
 
		if (!empty($verset) && !empty($livre) && !empty($chapitre)) $req_search .= " AND vst='" . $verset . "'";
		
	 
		if ($livre == "O") $req_search .= " AND id like '%O'";

		 
		if ($livre == "N") $req_search .= " AND id like '%N'";
		
	 
		if ($promesse == 1) $req_search .= " AND is_promesse='1'";
		
		$sql_search2 = mysql_db_query ($dbname2, str_replace ("id, ch, vst, $traduction", "id", $req_search), $connex_bible);
		$nb_results = mysql_num_rows ($sql_search2);

		$lapage = $start * $nb_resultpp;
		
		$req_search .= " LIMIT ". $lapage . ", " . $nb_resultpp;
		$sql_search = mysql_db_query ($dbname2, $req_search, $connex_bible);
		
		
 
		
		echo "<h2>Recherche dans la bible $title</h2>\n";
		echo "<div class=\"menu_versets\"><strong>$nb_results</strong> résultats trouvés";
		
		if (!empty($q)) echo " pour <h4>$q</h4>&nbsp;";
		if ($livre == "N") echo " dans le <h4>Nouveau Testament</h4>";
		elseif ($livre == "O") echo "dans l'<h4>Ancien Testament</h4>";
		elseif (!empty($livre)) {
			
			echo " dans <h4>$nom_livre";
			if (!empty($chapitre)) echo " $chapitre";
			echo "</h4>\n";
		}
		else echo " dans <h4>Toute la Bible</h4><br />\n";
			
		echo "</div>";
		
		if ($nb_results != 0 ) {
		
	 
			$barre_nav = barrenavig();
			$leverset .= $barre_nav;			

			while ($line = mysql_fetch_object ($sql_search)) {
			
		 
				$sql_titrelivre = mysql_db_query ($dbname2, "SELECT livre FROM ref_bible WHERE id='" . $line->id . "'", $connex_bible);
				$titre_livre = mysql_fetch_object ($sql_titrelivre);
				$nom_livre = $titre_livre->livre;
				
			 
				echo  "<div id=\"verset\"><div class=\"reference\"><a href=\"?action=texte&livre=" . $line->id . "&chapitre=" . $line->ch . "#" . $line->vst . "\"
					   class=\"reference\">" . $nom_livre . " " . $line->ch . " : " . $line->vst . "</a></div>\n";
				
				if ($LSG == 1) 			 $verset_enforme = $line->LSG;
				elseif ($darby == 1) 	 $verset_enforme = $line->darby;
				elseif ($martin == 1) 	 $verset_enforme = $line->martin;
				elseif ($ostervald == 1) $verset_enforme = $line->ostervald;
				
				foreach ($tab_mc as $mot) {
								
					if (strlen($mot) > 2) {
					
						$verset_enforme = eregi_replace ($mot, "<span class=\"mc\">$mot</span>", $verset_enforme);
						$verset_enforme = eregi_replace (francais2($mot), "<span class=\"mc\">" . francais2($mot) . "</span>", $verset_enforme);
					}
				}
				$verset_enforme = eregi_replace ($q, "<span class=\"mc\">$q</span>", $verset_enforme);
				echo str_replace('`', '\'', $verset_enforme) . "</div>\n";
			}
			echo $barre_nav ;
			
		} 
		
		else {  
			
			echo "<div id=\"message\">Aucun verset ne correspond à votre requète : </div>";
			if (!empty($livre)) echo "<a href=\"?action=recherche&livre=&mc=" . urlencode($q) . "\" >Effectuer une recherche dans toute la Bible</a>";
		}
		
	} 
	elseif ($action == "recherche" && strlen($q) < 2 && empty($livre)) echo "<div id=\"message\">Erreur : Le mots clé doit comporter au moins 2 caractères</div>";
	else $action = "texte";

 

	if ($action == "texte" && !empty($livre) && $livre != "N" && $livre != "O") {
	
		if (empty($chapitre) || $chapitre < 1) $chapitre = 1;
	
		if ($LSG == 1) 			 $col = "LSG";
		elseif ($darby == 1)   	 $col = "darby";
		elseif ($martin == 1) 	 $col = "martin";
		elseif ($ostervald == 1) $col = "ostervald";
		
	 
		$req_afficher = "SELECT $col, ch, vst FROM versets WHERE id='" . $livre . "' AND ch='" . $chapitre . "'";
		
		$sql_afficher2 = mysql_db_query ($dbname2, $req_afficher, $connex_bible);
		$nb_versets = mysql_num_rows ($sql_afficher2);
		
		if (!empty($verset)) $req_afficher .= " AND vst='" . $verset . "'";
		
		$sql_afficher = mysql_db_query ($dbname2, $req_afficher, $connex_bible);
		
	 
		if (substr($livre, -1) == "N") $dossier = "NT";
		elseif (substr($livre, -1) == "O") $dossier = "AT";

		if ($chapitre < 10) $lechapitre = "0" . $chapitre;
		else $lechapitre = $chapitre;
		
		$mp3 = "http://www.monsite.net/audio/bible/$dossier/" . $livre . "_" . $lechapitre . ".mp3";
		
		$bouton_ecouter = '<p><table border="0" cellpadding="2" cellspacing="0">
			  <tr>
				<td><strong>ECOUTER (LSG)</strong></td>
				<td>
					<object type="application/x-shockwave-flash" data="' .$racine . 'dewplayer.swf?son=' . $mp3 .'" width="200" height="20"> 
						<param name="movie" value="' .$racine . 'dewplayer.swf?son=' . $mp3 .'" />  
					</object>
				</td>
				<td><a href="'. $mp3 .'" rel=enclosure title="Flux du fichier"><img src="' .$racine . 'images/podcast.png" border="0"/></a></td>
			  </tr>
		</table></p>';			
		
	 
		
		echo "<h2>" . $nom_livre . " " . $chapitre . " (" . trim($title) . ") </h2>\n";
		
 

		$barre_nav = "<div class=\"menu_versets\">\n";
		$barre_nav .= "<strong>versets</strong> :\n";
		
		for ($i = 1; $i != $nb_versets + 1; $i++) {
		
			if ($action != "recherche") $barre_nav .= " <a class=\"black\" href=\"#$i\">$i</a>";
			else $barre_nav .= " <a class=\"black\" href=\"?action=texte&livre=$livre&chapitre=5#$i\">$i</a>";
		}
		echo $barre_nav .= "</div>\n";
		
 
		
 		echo "<p>" . $bouton_ecouter . "</p>";
		
		while ($line = mysql_fetch_object ($sql_afficher)) {
		
			echo "<div id=\"verset\">\n";
			echo "<a name=\"" . $line->vst . "\"></a>\n\n<div class=\"reference\">" . $line->ch . " : " . $line->vst . "</div>";
			
			if ($LSG == 1) {
				
				$verset_enforme = $line->LSG;
				if (!empty($q)) $verset_enforme = ereg_replace ($q, "<div class=\"mc\">$q</div>", $verset_enforme);
			}
			elseif ($darby == 1) {
				
				$verset_enforme = $line->darby;
				if (!empty($q)) $verset_enforme = ereg_replace ($q, "<div class=\"mc\">$q</div>", $verset_enforme);
			}
			elseif ($martin == 1) {
				
				$verset_enforme = $line->martin;
				if (!empty($q)) $verset_enforme = ereg_replace ($q, "<div class=\"mc\">$q</div>", $verset_enforme);
			}
			elseif ($ostervald == 1) {
				
				$verset_enforme = $line->ostervald;
				if (!empty($q)) $verset_enforme = ereg_replace ($q, "<div class=\"mc\">$q</div>", $verset_enforme);
			}
			echo str_replace('`', '\'', $verset_enforme);
			echo "</div>";
		}
		if (empty($verset) && $i >= 10) echo $barre_nav;
	} 
	
	mysql_close ($connex_bible);
?>

merci d'avance
 
WRInaute accro
ben tu regardes à quoi correspondent les erreurs marquées et tu corriges.
Visiblement les scripts ont été écrits en php4 (ce qui fait qu'on pouvait avoir un script qui débute avec <? alors que php5 veut <?php) donc pas mal d'erreurs à corriger
 
Nouveau WRInaute
merci pour la réponse

J’ai pu corriger certaines erreurs, mais ils en restent encore
Y a-t-il quelqu'un pour m’aider ?
Merci

Code:
Notice: Undefined index: LSG in C:\wamp\www\bible_php\bible.php on line 26

Notice: Undefined index: darby in C:\wamp\www\bible_php\bible.php on line 27

Notice: Undefined index: martin in C:\wamp\www\bible_php\bible.php on line 28

Notice: Undefined index: ostervald in C:\wamp\www\bible_php\bible.php on line 29

Notice: Undefined index: change_vst in C:\wamp\www\bible_php\bible.php on line 30

Notice: Undefined index: cookie_ok in C:\wamp\www\bible_php\bible.php on line 31

Notice: Undefined index: change_vst in C:\wamp\www\bible_php\bible.php on line 32

Notice: Undefined index: promesse in C:\wamp\www\bible_php\bible.php on line 33

Notice: Undefined index: livre in C:\wamp\www\bible_php\bible.php on line 34

Notice: Undefined index: chapitre in C:\wamp\www\bible_php\bible.php on line 35

Notice: Undefined index: verset in C:\wamp\www\bible_php\bible.php on line 36

Notice: Undefined index: q in C:\wamp\www\bible_php\bible.php on line 37

Notice: Undefined index: start in C:\wamp\www\bible_php\bible.php on line 38

Notice: Undefined index: action in C:\wamp\www\bible_php\bible.php on line 41

Notice: Undefined index: promesse in C:\wamp\www\bible_php\bible.php on line 43

Notice: Undefined variable: larequete in C:\wamp\www\bible_php\bible.php on line 52

Notice: Undefined variable: larequete in C:\wamp\www\bible_php\bible.php on line 54

Notice: Trying to get property of non-object in C:\wamp\www\bible_php\bible.php on line 68



Ça correspond à ces lignes


Code:
$LSG 		= $_REQUEST["LSG"];
	$darby 		= $_REQUEST["darby"];
	$martin 	= $_REQUEST["martin"];
	$ostervald 	= $_REQUEST["ostervald"];
	$change_vst = $_REQUEST["change_vst"];
	$cookie_ok 	= $_REQUEST["cookie_ok"];
	$change_vst = $_REQUEST["change_vst"];
	$promesse 	= $_REQUEST["promesse"];
	$livre 		= $_REQUEST["livre"];
	$chapitre 	= $_REQUEST["chapitre"];
	$verset 	= $_REQUEST["verset"];
	$q 			= $_REQUEST["q"];
	$start		= $_REQUEST["start"];

	if (empty($action) || ($action == "recherche" && $q < 2)) $action = $_REQUEST["action"];
         if (empty($promesse) && $change_vst != 1) $promesse = $_REQUEST["promesse"]; 
         $larequete2 = $larequete . "&action=" . $action; ;
          if (!empty($LSG))		$larequete .= "&LSG=" . $LSG;
        $nom_livre = $titre_livre->livre;


merci d'avance
 
WRInaute accro
Nathan-971 a dit:
Code:
Notice: Undefined index: LSG in C:\wamp\www\bible_php\bible.php on line 26
$LSG         = $_REQUEST["LSG"];[/quote]ben c'est clair, ton index LSG n'existe pas dans ton $_REQUEST, pareil pour les autres.
Donc essaye de voir pourquoi il n'existe pas.
Sinon, il faut remplacer [code]$LSG         = $_REQUEST["LSG"]
par
Code:
$LSG         = (isset($_REQUEST["LSG"])?$_REQUEST["LSG"]:"")
et il n'y aura plus d'erreur
 
Nouveau WRInaute
J’ai bien pris le soin de tout changer correctement, mais maintenant j’ai ça comme erreur
Code:
Parse error: parse error in C:\wamp\www\bible_php\bible.php on line 27
 
WRInaute occasionnel
Mais t'as pas pris le soin de dire 'merci', pas sûr que la solution tombe dans le bec tout cuit. ^^
 
WRInaute accro
Nathan-971 a dit:
Leonick a dit:
Visiblement tous ceux qui viennent demander de l’aide ici ont un problème avec PHP, pas que moi.
Merci de supprimer ce poste.
c'est pour cela que le siteduzeoro existe. Pour donner les bases.
As-tu au moins commencé à lire ce site ?
le but de wri n'est pas de développer à la place des autres, mais de donner des solutions pour que les autres deviennent autonomes.
 
WRInaute occasionnel
Nathan-971 a dit:
Merci de supprimer ce poste !!!!

Etrange réaction devant des gens qui essayent de t'aider... :roll:
Pourquoi censurer un post censé t'aider ?

Ca ne donne pas vraiment envie de te filer un coup de main...
 

➡️ Offre MyRankingMetrics ⬅️

pré-audit SEO gratuit avec RM Tech (+ avis d'expert)
coaching offert aux clients (avec Olivier Duffez ou Fabien Faceries)

Voir les détails ici

coaching SEO
Discussions similaires
Haut