Moteur de recherche - You have an error in your SQL syntax

Petit nouveau ! | 7 Messages

06 sept. 2011, 14:04

Bonjour,

J'ai développé un petit moteur de recherche en PHP constitué de deux fichiers PHP :

le 1er "mod_searchcall.php" permet de choisir les éléments à rechercher (pays, thématique, Aire d'intervention)
le second "searchresults" doit me ventiler les résultats dans des onglets selon leur nature.

Lorsque mon script charge le second fichier, l'erreur suivante apparaît :
WHERE country = 1You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE country = 1' at line 1
Je teste que les données passent bien,
Array
(
[country] => 1
[issues] =>
[areas] =>
[submit] => Rechercher
)
ce qui est le cas, mais je n'arrive pas à trouver où se trouve l'erreur!

Je vous laisse le code de mon second fichier, peut-être quelqu'un pourra-t'il m'aiguiller ?

Merci d'avance de vos suggestions,

Marc



Code : Tout sélectionner

<?php // DANS $WHERE ON INSERE LA CLAUSE WHERE DE LA REQUETE, // CETTE CLAUSE DEPEND DES VARIABLES RENVOYEES PAR LE // FORMULAIRE $where = ""; // SI L'UTILISATEUR A SPECIFIE UN PAYS, ON CREE LA CLAUSE // WHERE AVEC COUNTRY - CE CHAMP EST OBLIGATOIRE $country = $_GET['country']; if(isset($country) and $country != null) { $where = "WHERE country = $country"; } // SI L'UTILISATEUR A SPECIFIE LA THEMATIQUE D'INTERVENTION, ON CREE LA CLAUSE // WHERE AVEC ISSUES $issues = $_GET['issues']; if(isset($issues) and $issues != null and $where != "") { $where .= " AND issues = '$issues'"; } // SI L'UTILISATEUR A SPECIFIE LA ZONE D'INTERVENTION, ON CREE LA CLAUSE // WHERE AVEC AREAS $areas = $_GET['areas']; if(isset($areas) and $areas != null and $where != "") { $where .= " AND areas = '$areas'"; } ?>

ViPHP
ViPHP | 2577 Messages

06 sept. 2011, 14:50

Bonjour,

Il faudrait nous montrer l'ordre SQL en entier.
Eventuellement country est du varchar et il faut mettre country = '1'

Petit nouveau ! | 7 Messages

06 sept. 2011, 15:07

Bonjour,

Merci pour votre feedback, ci-après le code dans son intégralité :

Merci d'avance pour vos suggestions.

Marc

1ère page

Code : Tout sélectionner

<?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } // REQUETES mysql_select_db($database_donatoo, $donatoo); $query_r_lst_interventionthematics = "SELECT * FROM lst_interventionthematics"; $r_lst_interventionthematics = mysql_query($query_r_lst_interventionthematics, $donatoo) or die(mysql_error()); $row_r_lst_interventionthematics = mysql_fetch_assoc($r_lst_interventionthematics); $totalRows_r_lst_interventionthematics = mysql_num_rows($r_lst_interventionthematics); mysql_select_db($database_donatoo, $donatoo); $query_r_lst_interventionareas = "SELECT * FROM lst_interventionareas"; $r_lst_interventionareas = mysql_query($query_r_lst_interventionareas, $donatoo) or die(mysql_error()); $row_r_lst_interventionareas = mysql_fetch_assoc($r_lst_interventionareas); $totalRows_r_lst_interventionareas = mysql_num_rows($r_lst_interventionareas); mysql_select_db($database_donatoo, $donatoo); $query_r_lst_countries = "SELECT * FROM lst_countries ORDER BY id ASC"; $r_lst_countries = mysql_query($query_r_lst_countries, $donatoo) or die(mysql_error()); $row_r_lst_countries = mysql_fetch_assoc($r_lst_countries); $totalRows_r_lst_countries = mysql_num_rows($r_lst_countries); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Rechercher une source de financement</title> <link href="searchcall.css" rel="stylesheet" type="text/css" title="forms" /> <link href="../../templates/donatoopublicfr/css/template.css" rel="stylesheet" type="text/css" title="forms" /> </head> <body> <div class="art-blockheader"> <div class="l"></div> <div class="r"></div> <h3 class="t">Chercher un cause à soutenir !</h3> </div> <div class="art-blockcontent-body""> <form action="searchresults.php" method="get" name="search" id="search"> <table width="100%" border="1"> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>&nbsp;</td> <td>Pays d'intervention</td> <td>&nbsp;</td> <td> <select name="country" id="country"> <?php do { ?> <option value="<?php echo $row_r_lst_countries['id']?>"><?php echo $row_r_lst_countries['countryfr']?></option> <?php } while ($row_r_lst_countries = mysql_fetch_assoc($r_lst_countries)); $rows = mysql_num_rows($r_lst_countries); if($rows > 0) { mysql_data_seek($r_lst_countries, 0); $row_r_lst_countries = mysql_fetch_assoc($r_lst_countries); } ?> </select> </td> <td>&nbsp;</td> </tr> <tr> <td>&nbsp;</td> <td>Thématique d'intervention</td> <td>&nbsp;</td> <td> <select name="issues" id="issues"> <?php do { ?> <option value="<?php echo $row_r_lst_interventionthematics['id']?>"><?php echo $row_r_lst_interventionthematics['thematicfr']?></option> <?php } while ($row_r_lst_interventionthematics = mysql_fetch_assoc($r_lst_interventionthematics)); $rows = mysql_num_rows($r_lst_interventionthematics); if($rows > 0) { mysql_data_seek($r_lst_interventionthematics, 0); $row_r_lst_interventionthematics = mysql_fetch_assoc($r_lst_interventionthematics); } ?> </select> </td> <td>&nbsp;</td> </tr> <tr> <td>&nbsp;</td> <td>Aire d'intervention</td> <td>&nbsp;</td> <td> <select name="areas" id="areas"> <option value=""""></option> <?php do { ?> <option value="<?php echo $row_r_lst_interventionareas['id']?>"><?php echo $row_r_lst_interventionareas['areafr']?></option> <?php } while ($row_r_lst_interventionareas = mysql_fetch_assoc($r_lst_interventionareas)); $rows = mysql_num_rows($r_lst_interventionareas); if($rows > 0) { mysql_data_seek($r_lst_interventionareas, 0); $row_r_lst_interventionareas = mysql_fetch_assoc($r_lst_interventionareas); } ?> </select> </td> <td>&nbsp;</td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td><input class="button" type="submit" name="submit" id="submit" value="Rechercher"></td> <td>&nbsp;</td> </tr> </table> </form> </div> </div> </body> </html> <?php mysql_free_result($r_lst_interventionthematics); mysql_free_result($r_lst_interventionareas); mysql_free_result($r_lst_countries); ?>
Seconde page

Code : Tout sélectionner

<?php // VERIFIER QUE LES VARIABLES GET PASSENT BIEN echo "<pre>"; print_r($_GET); echo "</pre>"; ?> <?php // DANS $WHERE ON INSERE LA CLAUSE WHERE DE LA REQUETE, // CETTE CLAUSE DEPEND DES VARIABLES RENVOYEES PAR LE // FORMULAIRE $where = ""; // if(isset($_GET['TypeEnregistrement']) && $_GET['TypeEnregistrement']=='nounou') // SI L'UTILISATEUR A SPECIFIE UN PAYS, ON CREE LA CLAUSE // WHERE AVEC COUNTRY $country = $_GET['country']; if(isset($country) and $country != null) $where = "WHERE country = $country"; // SI L'UTILISATEUR A SPECIFIE LA THEMATIQUE D'INTERVENTION, ON CREE LA CLAUSE // WHERE AVEC ISSUES $issues = $_GET['issues']; if(isset($issues) and $issues != null and $where != "") { $where .= " AND issues = '$issues'"; } // SI L'UTILISATEUR A SPECIFIE LA ZONE D'INTERVENTION, ON CREE LA CLAUSE // WHERE AVEC AREAS $areas = $_GET['areas']; if(isset($areas) and $areas != null and $where != "") { $where .= " AND areas = '$areas'"; } ?> <?php echo $where; ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_donatoo, $donatoo); $query_r_lst_callprog = "SELECT * FROM doo_call_prog $where"; $r_lst_callprog = mysql_query($query_r_lst_callprog, $donatoo) or die(mysql_error()); $row_r_lst_callprog = mysql_fetch_assoc($r_lst_callprog); $totalRows_r_lst_callprog = mysql_num_rows($r_lst_callprog); mysql_select_db($database_donatoo, $donatoo); $query_r_lst_callaction = "SELECT doo_call_action $where"; $r_lst_callaction = mysql_query($query_r_lst_callaction, $donatoo) or die(mysql_error()); $row_r_lst_callaction = mysql_fetch_assoc($r_lst_callaction); $totalRows_r_lst_callaction = mysql_num_rows($r_lst_callaction); mysql_select_db($database_donatoo, $donatoo); $query_r_lst_calloverhead = "SELECT doo_call_overhead $where"; $r_lst_calloverhead = mysql_query($query_r_lst_calloverhead, $donatoo) or die(mysql_error()); $row_r_lst_calloverhead = mysql_fetch_assoc($r_lst_calloverhead); $totalRows_r_lst_calloverhead = mysql_num_rows($r_lst_calloverhead); mysql_select_db($database_donatoo, $donatoo); $query_r_lst_calltime = "SELECT doo_call_time $where"; $r_lst_calltime = mysql_query($query_r_lst_calltime, $donatoo) or die(mysql_error()); $row_r_lst_calltime = mysql_fetch_assoc($r_lst_calltime); $totalRows_r_lst_calltime = mysql_num_rows($r_lst_calltime); mysql_select_db($database_donatoo, $donatoo); $query_r_lst_callcompetences = "SELECT doo_call_competences $where"; $r_lst_callcompetences = mysql_query($query_r_lst_callcompetences, $donatoo) or die(mysql_error()); $row_r_lst_callcompetences = mysql_fetch_assoc($r_lst_callcompetences); $totalRows_r_lst_callcompetences = mysql_num_rows($r_lst_callcompetences); mysql_select_db($database_donatoo, $donatoo); $query_r_lst_callideas = "SELECT * FROM doo_call_ideas $where"; $r_lst_callideas = mysql_query($query_r_lst_ideas, $donatoo) or die(mysql_error()); $row_r_lst_callideas = mysql_fetch_assoc($r_lst_callideas); $totalRows_r_lst_callideas = mysql_num_rows($r_lst_callideas); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Chercher une cause à soutenir</title> <link href="fds_assearch.css" rel="stylesheet" type="text/css" /> <script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script> <link href="spryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" /> <link href="css/bd_if_search.css" rel="stylesheet" type="text/css" /> </head> <body class="twoColFixLtHdr"> <div id="Results"> <div id="TabbedPanels1" class="TabbedPanels"> <ul class="TabbedPanelsTabGroup"> <li class="TabbedPanelsTab" tabindex="0" style="font-family:'Trebuchet MS'; font-size:11px">Projets <?php $resultat = mysql_num_rows($r_lst_callprog); echo "[$resultat résultats\n]"; ?> </li> <li class="TabbedPanelsTab" tabindex="0" style="font-family:'Trebuchet MS'; font-size:11px">Actions <?php $resultat = mysql_num_rows($r_lst_callaction); echo "[$resultat résultats\n]"; ?> </li> <li class="TabbedPanelsTab" tabindex="0" style="font-family:'Trebuchet MS'; font-size:11px">Frais de structure <?php $resultat = mysql_num_rows($r_lst_overhead); echo "[$resultat résultats\n]"; ?> </li> <li class="TabbedPanelsTab" tabindex="0" style="font-family:'Trebuchet MS'; font-size:11px">Temps <?php $resultat = mysql_num_rows($r_lst_calltime); echo "[$resultat résultats\n]"; ?> </li> <li class="TabbedPanelsTab" tabindex="0" style="font-family:'Trebuchet MS'; font-size:11px">Compétences <?php $resultat = mysql_num_rows($r_lst_callcompetences); echo "[$resultat résultats\n]"; ?> </li> <li class="TabbedPanelsTab" tabindex="0" style="font-family:'Trebuchet MS'; font-size:11px">Idées <?php $resultat = mysql_num_rows($r_lst_callideas); echo "[$resultat résultats\n]"; ?> </li> </ul> <div class="TabbedPanelsContentGroup"> <div class="TabbedPanelsContent"> <table width="100%" border="0"> <tr class="res_title"> <td scope="row">Thématique</td> <td>Aire d'intervention</td> <td>Pays</td> <td>Titre du projet</td> <td>Date de début</td> <td>Date de fin</td> <td>x</td> <td>x</td> <td>x</td> </tr> <?php do { ?> <form action="X" id="projet" name="projet" method="get"> <tr class="res_list"> <td scope="row"> <input name="id" type="hidden" id="id" value="<?php echo $row_r_lst_callprog['id']; ?>" /> <?php echo $row_r_lst_callprog['issues']; ?></td> <td><?php echo $row_r_lst_callprog['areas']; ?></td> <td><?php echo $row_r_lst_callprog['country']; ?></td> <td><?php $max_caracteres=50; // On compte le nombre de lettre grace a strlen if (strlen($row_r_lst_callprog['nameprog'])>$max_caracteres){ // On coupe la chaine de caractere a max_caracteres $row_r_lst_callprog['nameprog'] = substr($row_r_lst_callprog['nameprog'], 0, $max_caracteres); // On recupere la position du dernier espace $position_espace = strrpos($row_r_lst_callprog['nameprog'], " "); $row_r_lst_callprog['nameprog'] = substr($row_r_lst_callprog['nameprog'], 0, $position_espace); // On affiche les ... $row_r_lst_callprog['nameprog'] = $row_r_lst_callprog['nameprog']."..."; } echo $row_r_lst_callprog['nameprog']; ?> </td> <td><?php echo $row_r_lst_callprog['datestartprog']; ?></td> <td><?php echo $row_r_lst_callprog['dateendprog']; ?></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><input type="image" src="../../images/icones/Computer.png" width="15" height="15" name="submit" id="submit" value="fiche IF" /></td> </tr> </form> <?php } while ($row_r_lst_callprog = mysql_fetch_assoc($r_lst_callprog)); ?> </table> </div> <div class="TabbedPanelsContent"> <table width="100%" border="0"> <tr class="res_title"> <td scope="row">Thématique</td> <td>Aire d'intervention</td> <td>Pays</td> <td>Titre du projet</td> <td>Date de début</td> <td>Date de fin</td> <td>x</td> <td>x</td> <td>x</td> </tr> <?php do { ?> <form action="X" id="action" name="action" method="get"> <tr class="res_list"> <td scope="row"> <input name="id" type="hidden" id="id" value="<?php echo $row_r_lst_callaction['id']; ?>" /> <?php echo $row_r_lst_callaction['issues']; ?></td> <td><?php echo $row_r_lst_callaction['areas']; ?></td> <td><?php echo $row_r_lst_callaction['country']; ?></td> <td><?php $max_caracteres=50; // On compte le nombre de lettre grace a strlen if (strlen($row_r_lst_callaction['nameaction'])>$max_caracteres){ // On coupe la chaine de caractere a max_caracteres $row_r_lst_callaction['nameaction'] = substr($row_r_lst_callaction['nameaction'], 0, $max_caracteres); // On recupere la position du dernier espace $position_espace = strrpos($row_r_lst_callaction['nameaction'], " "); $row_r_lst_callaction['nameaction'] = substr($row_r_lst_callaction['nameaction'], 0, $position_espace); // On affiche les ... $row_r_lst_callaction['nameaction'] = $row_r_lst_callaction['nameaction']."..."; } echo $row_r_lst_callaction['nameaction']; ?> </td> <td><?php echo $row_r_lst_callaction['datestartaction']; ?></td> <td><?php echo $row_r_lst_callaction['dateendaction']; ?></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><input type="image" src="../../images/icones/Computer.png" width="15" height="15" name="submit" id="submit" value="fiche IF" /></td> </tr> </form> <?php } while ($row_r_lst_callaction = mysql_fetch_assoc($r_lst_callaction)); ?> </table> </div> <div class="TabbedPanelsContent"> <table width="100%" border="0"> <tr class="res_title"> <td scope="row">X - Thématique</td> <td>Aire d'intervention</td> <td>Pays</td> <td>Titre du projet</td> <td>Date de début</td> <td>Date de fin</td> <td>x</td> <td>x</td> <td>x</td> </tr> <?php do { ?> <form action="X" id="fraisstructure" name="fraisstructure" method="get"> <tr class="res_list"> <td scope="row"><input name="id" type="hidden" id="id" value="<?php echo $row_r_lst_calloverhead['id']; ?>" /></td> <td><?php echo $row_r_lst_calloverhead['areas']; ?></td> <td><?php echo $row_r_lst_calloverhead['country']; ?></td> <td><?php $max_caracteres=50; // On compte le nombre de lettre grace a strlen if (strlen($row_r_lst_calloverhead['nameoverhead'])>$max_caracteres){ // On coupe la chaine de caractere a max_caracteres $row_r_lst_calloverhead['nameoverhead'] = substr($row_r_lst_calloverhead['nameoverhead'], 0, $max_caracteres); // On recupere la position du dernier espace $position_espace = strrpos($row_r_lst_calloverhead['nameoverhead'], " "); $row_r_lst_calloverhead['nameoverhead'] = substr($row_r_lst_calloverhead['nameoverhead'], 0, $position_espace); // On affiche les ... $row_r_lst_calloverhead['nameoverhead'] = $row_r_lst_calloverhead['nameoverhead']."..."; } echo $row_r_lst_calloverhead['nameoverhead']; ?> </td> <td><?php echo $row_r_lst_calloverhead['datestartoverhead']; ?></td> <td><?php echo $row_r_lst_calloverhead['dateendoverhead']; ?></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><input type="image" src="../../images/icones/Computer.png" width="15" height="15" name="submit" id="submit" value="fiche IF" /></td> </tr> </form> <?php } while ($row_r_lst_calloverhead = mysql_fetch_assoc($r_lst_calloverhead)); ?> </table> </div> <div class="TabbedPanelsContent"> <table width="100%" border="0"> <tr class="res_title"> <td scope="row">X - Thématique</td> <td>Aire d'intervention</td> <td>Pays</td> <td>Titre du projet</td> <td>Date de début</td> <td>Date de fin</td> <td>x</td> <td>x</td> <td>x</td> </tr> <?php do { ?> <form action="X" id="temps" name="temps" method="get"> <tr class="res_list"> <td scope="row"><input name="id" type="hidden" id="id" value="<?php echo $row_r_lst_calltime['id']; ?>" /></td> <td><?php echo $row_r_lst_calltime['areas']; ?></td> <td><?php echo $row_r_lst_calltime['country']; ?></td> <td><?php $max_caracteres=50; // On compte le nombre de lettre grace a strlen if (strlen($row_r_lst_calltime['calltitle'])>$max_caracteres){ // On coupe la chaine de caractere a max_caracteres $row_r_lst_calltime['calltitle'] = substr($row_r_lst_calltime['calltitle'], 0, $max_caracteres); // On recupere la position du dernier espace $position_espace = strrpos($row_r_lst_calltime['calltitle'], " "); $row_r_lst_calltime['calltitle'] = substr($row_r_lst_calltime['calltitle'], 0, $position_espace); // On affiche les ... $row_r_lst_calltime['calltitle'] = $row_r_lst_calltime['calltitle']."..."; } echo $row_r_lst_calltime['calltitle']; ?> </td> <td><?php echo $row_r_lst_calltime['datestart']; ?></td> <td><?php echo $row_r_lst_calltime['dateend']; ?></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><input type="image" src="../../images/icones/Computer.png" width="15" height="15" name="submit" id="submit" value="fiche IF" /></td> </tr> </form> <?php } while ($row_r_lst_calltime = mysql_fetch_assoc($r_lst_calltime)); ?> </table> </div> <div class="TabbedPanelsContent"> <table width="100%" border="0"> <tr class="res_title"> <td scope="row">X - Thématique</td> <td>Aire d'intervention</td> <td>Pays</td> <td>Titre du projet</td> <td>Date de début</td> <td>Date de fin</td> <td>x</td> <td>x</td> <td>x</td> </tr> <?php do { ?> <form action="X" id="compétences" name="compétences" method="get"> <tr class="res_list"> <td scope="row"><input name="id" type="hidden" id="id" value="<?php echo $row_r_lst_callcompetences['id']; ?>" /></td> <td><?php echo $row_r_lst_callcompetences['areas']; ?></td> <td><?php echo $row_r_lst_callcompetences['country']; ?></td> <td><?php $max_caracteres=50; // On compte le nombre de lettre grace a strlen if (strlen($row_r_lst_callcompetences['calltitle'])>$max_caracteres){ // On coupe la chaine de caractere a max_caracteres $row_r_lst_callcompetences['calltitle'] = substr($row_r_lst_callcompetences['calltitle'], 0, $max_caracteres); // On recupere la position du dernier espace $position_espace = strrpos($row_r_lst_callcompetences['calltitle'], " "); $row_r_lst_callcompetences['calltitle'] = substr($row_r_lst_callcompetences['calltitle'], 0, $position_espace); // On affiche les ... $row_r_lst_callcompetences['calltitle'] = $row_r_lst_callcompetences['calltitle']."..."; } echo $row_r_lst_callcompetences['calltitle']; ?> </td> <td><?php echo $row_r_lst_callcompetences['datestart']; ?></td> <td><?php echo $row_r_lst_callcompetences['dateend']; ?></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><input type="image" src="../../images/icones/Computer.png" width="15" height="15" name="submit" id="submit" value="fiche IF" /></td> </tr> </form> <?php } while ($row_r_lst_callcompetences = mysql_fetch_assoc($r_lst_callcompetences)); ?> </table> </div> <div class="TabbedPanelsContent"> <table width="100%" border="0"> <tr class="res_title"> <td scope="row">X - Thématique</td> <td>Aire d'intervention</td> <td>Pays</td> <td>Titre du projet</td> <td>Date de début</td> <td>Date de fin</td> <td>x</td> <td>x</td> <td>x</td> </tr> <?php do { ?> <form action="X" id="compétences" name="compétences" method="get"> <tr class="res_list"> <td scope="row"><input name="id" type="hidden" id="id" value="<?php echo $row_r_lst_callidas['id']; ?>" /></td> <td><?php echo $row_r_lst_callidas['areas']; ?></td> <td><?php echo $row_r_lst_callidas['country']; ?></td> <td><?php $max_caracteres=50; // On compte le nombre de lettre grace a strlen if (strlen($row_r_lst_callidas['calltitle'])>$max_caracteres){ // On coupe la chaine de caractere a max_caracteres $row_r_lst_callidas['calltitle'] = substr($row_r_lst_callidas['calltitle'], 0, $max_caracteres); // On recupere la position du dernier espace $position_espace = strrpos($row_r_lst_callidas['calltitle'], " "); $row_r_lst_callidas['calltitle'] = substr($row_r_lst_callidas['calltitle'], 0, $position_espace); // On affiche les ... $row_r_lst_callidas['calltitle'] = $row_r_lst_callidas['calltitle']."..."; } echo $row_r_lst_callidas['calltitle']; ?> </td> <td><?php echo $row_r_lst_callidas['datestart']; ?></td> <td><?php echo $row_r_lst_callidas['dateend']; ?></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><input type="image" src="../../images/icones/Computer.png" width="15" height="15" name="submit" id="submit" value="fiche IF" /></td> </tr> </form> <?php } while ($row_r_lst_callidas = mysql_fetch_assoc($r_lst_callidas)); ?> </table> </div> </div> </div> <script type="text/javascript"> <!-- var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1"); //--> </script> </body> </html> <?php mysql_free_result($r_lst_callprog); mysql_free_result($r_lst_callaction); mysql_free_result($r_lst_calloverhead); mysql_free_result($r_lst_calltime); mysql_free_result($r_lst_callcompetences); mysql_free_result($r_lst_callideas); ?>

Avatar du membre
Modérateur PHPfrance
Modérateur PHPfrance | 8758 Messages

06 sept. 2011, 17:58

salut,

625 lignes de code c'est 600 de trop :mrgreen:

on va pas fouiller tous ça pour voir la chose (enfin pas envie la ;) ).

ce que demande Ryle c'est la requête SQL qui correspond (celle que tu donne a manger au mysql_query ;) ).

étant donné qu'il y a un problème avant le where je pense que tu construit mal la requête le fait de l'afficher en entier dans les messages d'erreurs devrait t'aider grandement à résoudre ton problème.

mais la je peux pas t'aider plus, sans la requête exacte et juste le code concerné.

edit : en fait j'ai demandé a mon éditeur de texte favoris de rechercher WHERE country = dans tous ça et j'ai vu des chose étonnante :
<?php
$query_r_lst_callaction = "SELECT doo_call_action $where";

mysql_select_db($database_donatoo, $donatoo);
$query_r_lst_calloverhead = "SELECT doo_call_overhead $where";

mysql_select_db($database_donatoo, $donatoo);
$query_r_lst_calltime = "SELECT doo_call_time $where";

mysql_select_db($database_donatoo, $donatoo);
$query_r_lst_callcompetences = "SELECT doo_call_competences $where";
?>
ces 3 select n'ont pas de from ce qui doit être la source de tes ennuis qui plus est un seul mysql_select_db est utile, juste après la connexion pas besoin d'en mettre 400.

Perso je te conseil "d'oublier" dreamweaver si tu souhaite comprendre ce que tu fait !


@+
Il en faut peu pour être heureux ......

Petit nouveau ! | 7 Messages

06 sept. 2011, 19:12

Merci Moogli, c'est très sympa d'avoir pris le temps de voir tout cela. Concernant dreamweaver tu as raison, je vais le lâcher petit à petit jusqu'à ce que je comprenne tout.

Je vais tenter de revoir tout cela.

Bye

Petit nouveau ! | 7 Messages

06 sept. 2011, 20:07

bonsoir Moogli,

Merci encore pour tes suggestions. Le code resp. les requêtes contenaient des erreurs, mais c'est corrigé à présent et cela fonctionne parfaitement. Je vais également lâcher rapidement dreamweaver, car c'est vrai on a tendance à mon se concentrer et surtout à zapper la compréhension du code.

Je n'ai pas trouvé comment marquer mon sujet comme [RESOLU] malgré les instructions sur la page suivante sous le point Sujet résolu :

annonces/lisez-moi-reglements-generaux-t12542.html

Bonne soirée.
salut,

625 lignes de code c'est 600 de trop :mrgreen:

on va pas fouiller tous ça pour voir la chose (enfin pas envie la ;) ).

ce que demande Ryle c'est la requête SQL qui correspond (celle que tu donne a manger au mysql_query ;) ).

étant donné qu'il y a un problème avant le where je pense que tu construit mal la requête le fait de l'afficher en entier dans les messages d'erreurs devrait t'aider grandement à résoudre ton problème.

mais la je peux pas t'aider plus, sans la requête exacte et juste le code concerné.

edit : en fait j'ai demandé a mon éditeur de texte favoris de rechercher WHERE country = dans tous ça et j'ai vu des chose étonnante :
<?php
$query_r_lst_callaction = "SELECT doo_call_action $where";

mysql_select_db($database_donatoo, $donatoo);
$query_r_lst_calloverhead = "SELECT doo_call_overhead $where";

mysql_select_db($database_donatoo, $donatoo);
$query_r_lst_calltime = "SELECT doo_call_time $where";

mysql_select_db($database_donatoo, $donatoo);
$query_r_lst_callcompetences = "SELECT doo_call_competences $where";
?>
ces 3 select n'ont pas de from ce qui doit être la source de tes ennuis qui plus est un seul mysql_select_db est utile, juste après la connexion pas besoin d'en mettre 400.

Perso je te conseil "d'oublier" dreamweaver si tu souhaite comprendre ce que tu fait !


@+

Avatar du membre
Modérateur PHPfrance
Modérateur PHPfrance | 8758 Messages

06 sept. 2011, 22:29

le bouton résolus est en vacances devrait revenir bientot :)

@+
Il en faut peu pour être heureux ......