felito Posted April 11, 2011 Share Posted April 11, 2011 hi This problem is the most strange thing that i seen in the last times. this code works <?php function conecta () { $host = "localhost"; $senha = "vertrigo"; $login = "xxx"; $database = "emprego"; $conexao = mysql_connect($host,$login,$senha) or die(mysql_error()); mysql_select_db($database,$conexao)or die; } conecta (); //more ?> but this doesn't work <?php require("includes/f_banco.php"); conecta (); ?> I never seen something like that. Any ideia? the paths are correct, the bd is correct and the query works when i put the function conecta() directly in the php file. Thanks Link to comment https://forums.phpfreaks.com/topic/233309-problem-with-includes/ Share on other sites More sharing options...
dcro2 Posted April 11, 2011 Share Posted April 11, 2011 What exactly do you mean by "doesn't work"? Do you get an error? Link to comment https://forums.phpfreaks.com/topic/233309-problem-with-includes/#findComment-1199847 Share on other sites More sharing options...
cssfreakie Posted April 11, 2011 Share Posted April 11, 2011 place this at the top of your script run it, and tell us more explicit what is not working: <?php error_reporting(E_ALL); ini_set("display_errors", 1); ?> Link to comment https://forums.phpfreaks.com/topic/233309-problem-with-includes/#findComment-1199849 Share on other sites More sharing options...
felito Posted April 11, 2011 Author Share Posted April 11, 2011 to avoid to put all code in post i will add this link: http://stackoverflow.com/questions/5615333/problem-in-a-validation-form-php i am the fel. I don't have any error. The only thing that i know is: with the function conecta() inside the file the query works fine. With the require or include (none error is given so i think the path is correct) the query returns something different than the massage that must retrieve. I don't have any idea how i can solve that. I obviously want to avoid to include explicitly the db config in the file. Link to comment https://forums.phpfreaks.com/topic/233309-problem-with-includes/#findComment-1199854 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.