MySQL Error: 1064 et accès au site

stefano -  
avion-f16 Messages postés 19182 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
A voir également:
  • MySQL Error: 1064 et accès au site
  • Eespt technical error - <a href="https://forums.commentcamarche.net/forum/tnt-satellite-reception-232">Forum TNT / Satellite / Réception</a>
  • Fan error lenovo - <a href="https://forums.commentcamarche.net/forum/pc-portable-238">Forum PC portable</a>
  • Pointage antenne - <a href="https://forums.commentcamarche.net/forum/tnt-satellite-reception-232">Forum TNT / Satellite / Réception</a>
  • Mysql error in file: /engine/classes/mysql.php at line 53 - <a href="https://forums.commentcamarche.net/forum/reseaux-sociaux-10">Forum Réseaux sociaux</a>
  • A disk read error occurred - <a href="https://forums.commentcamarche.net/forum/windows-11">Forum Windows</a>

1 réponse

avion-f16 Messages postés 19182 Date d'inscription   Statut Contributeur Dernière intervention   4 511
 
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