Jump to content

problem with includes


felito

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.