PHP|Débutant :: Forums

Advertisement

Besoin d'aide ? N'hésitez pas, mais respectez les règles

Vous n'êtes pas identifié(e).

#1 22-03-2011 21:14:43

iymohammed
Membre
Inscription : 22-03-2011
Messages : 1

an error in your SQL syntax

Bonjour,

Apres avoir réalisé mon code de $srch :

j'ai une erreur voici le message:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDRE BY tbl_nav.nav_id,tbl_pages.pg_link ASC' at line 3

et voici mon code :

mysql_select_db($database_connexions, $connexions);
if(isset($_GET['frmsch']) && $_GET['frmsch'] != ' ') {

$srch = $_GET['frmsch'];

$query_rsPages = "SELECT tbl_pages.pg_id,tbl_pages.pg_link,tbl_nav.nav_name FROM tbl_admins,
tbl_pages,tbl_nav WHERE tbl_pages.pg_nav = tbl_nav.nav_id AND (tbl_pages.pg_link LIKE '%srch%' OR tbl_pages.pg_cont LIKE
'%srch%' OR tbl_pages.pg_title LIKE '%srch%') ORDRE BY tbl_nav.nav_id,tbl_pages.pg_link ASC" ;

} else {

$query_rsPages = "SELECT tbl_pages.pg_id, tbl_pages.pg_link, tbl_nav.nav_name FROM tbl_admins,tbl_pages, tbl_nav WHERE tbl_pages.pg_nav = tbl_nav.nav_id ORDER BY tbl_nav.nav_id, tbl_pages.pg_link ASC";

}

$rsPages = mysql_query($query_rsPages, $connexions) or die(mysql_error());
$row_rsPages = mysql_fetch_assoc($rsPages);
$totalRows_rsPages = mysql_num_rows($rsPages);

Merci de votre aide

Hors ligne

#2 22-03-2011 21:59:47

Pierrot
Ancien nouveau
Inscription : 08-05-2009
Messages : 1 195

Re : an error in your SQL syntax

Salut


mysql_select_db($database_connexions, $connexions);
if(isset($_GET['frmsch']) && $_GET['frmsch'] != ' ') {
     $srch = $_GET['frmsch'];
     $query_rsPages = "SELECT tbl_pages.pg_id,tbl_pages.pg_link,tbl_nav.nav_name FROM tbl_admins,
     tbl_pages,tbl_nav WHERE tbl_pages.pg_nav = tbl_nav.nav_id AND (tbl_pages.pg_link LIKE '%srch%' OR tbl_pages.pg_cont LIKE
     '%srch%' OR tbl_pages.pg_title LIKE '%srch%') ORDRE BY tbl_nav.nav_id,tbl_pages.pg_link ASC"
;
 }
else {
    $query_rsPages = "SELECT tbl_pages.pg_id, tbl_pages.pg_link, tbl_nav.nav_name FROM tbl_admins,tbl_pages, tbl_nav WHERE tbl_pages.pg_nav =
    tbl_nav.nav_id ORDER BY tbl_nav.nav_id, tbl_pages.pg_link ASC"
;
}
    $rsPages = mysql_query($query_rsPages, $connexions) or die(mysql_error());
    $row_rsPages = mysql_fetch_assoc($rsPages);
    $totalRows_rsPages = mysql_num_rows($rsPages);
 

voila, comme çà, tu peux trouver tout seul
le message est pourtant clair wink

you have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDRE BY tbl_nav.nav_id,tbl_pages.pg_link ASC' at line 3


a++

Hors ligne

Pied de page des forums