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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.