SkyRanger Posted April 9, 2007 Share Posted April 9, 2007 I have been fighting with this for about an hour, it is late, I can't see the problem. Somebody have a look at this and let me know that the heck I am doing wrong: if (empty($_SESSION['language']['lid'])) { $_SESSION['language']['lid'] = "1"; } // mysql include "inc/dbinfo.inc.php"; $connection=mysql_connect ("$dblocation", "$dbusername", "$dbpassword") or die ('I cannot connect to the database because: ' . mysql_error()); $result = mysql_query( "SELECT * FROM 'languages' WHERE lid = '" . $_SESSION['language'] ['lid'] . "'" ) or die(mysql_error()); Error I am getting is: 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 ''languages' WHERE lid = '1'' at line 1 Link to comment https://forums.phpfreaks.com/topic/46226-solved-sql-syntax-error/ Share on other sites More sharing options...
SkyRanger Posted April 9, 2007 Author Share Posted April 9, 2007 Stupid me, found the problem, forgot to add the database Link to comment https://forums.phpfreaks.com/topic/46226-solved-sql-syntax-error/#findComment-224735 Share on other sites More sharing options...
MadTechie Posted April 9, 2007 Share Posted April 9, 2007 i always find the solutions just after i hit post button on this forum.. lol click solved Link to comment https://forums.phpfreaks.com/topic/46226-solved-sql-syntax-error/#findComment-224736 Share on other sites More sharing options...
PC Nerd Posted April 9, 2007 Share Posted April 9, 2007 ok, um in your error it says that the value of your session is '1', is that the value that yu want? Link to comment https://forums.phpfreaks.com/topic/46226-solved-sql-syntax-error/#findComment-224737 Share on other sites More sharing options...
PC Nerd Posted April 9, 2007 Share Posted April 9, 2007 lol, cool good luck Link to comment https://forums.phpfreaks.com/topic/46226-solved-sql-syntax-error/#findComment-224739 Share on other sites More sharing options...
SkyRanger Posted April 9, 2007 Author Share Posted April 9, 2007 That is the default until somebody chooses another language. But I found another problem, that is starting to tick me off: [b]Main PHP File[/b] include "./inc/get_language.php"; include "./lang" . $object->lpath . "main.lang.php"; include "install/header.inc"; echo NAME; include "install/footer.inc"; if (empty($_SESSION['language']['lid'])) { $_SESSION['language']['lid'] = '1'; } // mysql [b]get_language.php file[/b] include "inc/dbinfo.inc.php"; $connection=mysql_connect ("$dblocation", "$dbusername", "$dbpassword") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("$dbname"); $result = mysql_query( "SELECT * FROM languages WHERE lid = '" . $_SESSION['language']['lid'] . "'" ) or die(mysql_error()); And this is the error I am getting: Warning: include(./lang/main.lang.php) [function.include]: failed to open stream: No such file or directory Table data is: ____________________ | languages | |__________________| | lid | lpath | |__________________| | 1 | /english/ | | 2 | /french/ | |__________________| Can anybody see the problem? Link to comment https://forums.phpfreaks.com/topic/46226-solved-sql-syntax-error/#findComment-225071 Share on other sites More sharing options...
SkyRanger Posted April 9, 2007 Author Share Posted April 9, 2007 Has anybody got any ideas, not sure if I am missing a piece of code in the main.php file or what. The error I get is: Warning: include(./langmain.lang.php) [function.include]: failed to open stream: No such file or directory in /home/mysite/public_html/main.php on line 6 Warning: include() [function.include]: Failed opening './langmain.lang.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/mysite/public_html/main.php on line 6 This is how I need it to include: include './lang/english/main.lang.php'; Link to comment https://forums.phpfreaks.com/topic/46226-solved-sql-syntax-error/#findComment-225250 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.