hi this codes are not working i have got 2 files and one datebase its name is "haber" i am from Turkey -index.php -connect.php file path: haber/index.php haber/system/connect.php this is connect.php <?php $host='localhost'; $user='root'; $pass=''; $data='haber';//Veritabanı adı //baglan $connx=mysql_connect($host,$user,$pass); if($connx){ $dbConn=mysql_select_db($data,$connx) or die (mysql_error()); $language=mysql_query("SET CHARACHTER SET utf8")); } else{ die(mysql_query()); } ?> PHP: And this is index.php <?php $connectFile="haber/system/connect.php"; if(file_exists($connectFile)){ require $connectFile; } else{ echo"error"; } ?> PHP:
Since you're using relative paths, and you're already in the "haber" folder, you have to drop it from the path. $connectFile="system/connect.php"; PHP:
Spot on... generally speaking the more 'path' you try to use or any 'up-tree linking' (aka ../) you 'have' to use just means overthinking your directory structure. In this case everything is relative to where the index.php is run from, making it -- as nico_swd's answer shows, VERY simple. Also, listen to gvre -- they've been telling us for EIGHT YEARS to stop using mysql_ functions, and have FINALLY added giant red warning boxes to the manual pages saying same!
Besides the simplicity of not using up-tree linking, as deathshadow mentioned, adding '../haber' in the path adds a little overhead because of an extra stat call.
Parse error: syntax error, unexpected ')' in C:\AppServ\www\haber\system\connect.php on line 12 help me please
$language=mysql_query("SET CHARACHTER SET utf8")); one more ) than you open. Also might help if you spelled CHARACTER properly.