MySQL Error: 1064 et accès au site

stefano -  
avion-f16 Messages postés 20368 Date d'inscription   Statut Contributeur Dernière intervention   -
Bonjour,

alors voila j'ai un problème avec mon site:

lorsque j'y accède vie l'adresse http://monsite.com aucun problème tout fonctionne, mais lorsque j'y accède via http://www.monsite.com la j'obtiens une erreur sql sauf si je relance mon navigateur.

Voici l'erreur:
Database error: Invalid SQL: select C_Slogan from tbl_site_info where FK_LangID=   
MySQL Error: 1064 (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 '' at line 1)  
Session halted.


et voici la requete:
$lang=$Lang->current_lang();  

$Slogan = $db->sql_get_first("select C_Slogan from tbl_site_info where FK_LangID= ".$lang);


Merci d'avance

1 réponse

avion-f16 Messages postés 20368 Date d'inscription   Statut Contributeur Dernière intervention   4 510
 
Si $lang est une chaine il faut s'arranger pour que la requête envoyée à MySQL aie des guillemets autour de cette chaine.
$Slogan = $db->sql_get_first('SELECT C_Slogan FROM tbl_site_info WHERE FK_LangID= "'.$lang.'"');

0