Jump to content

Is this a problem with the server?


wemustdesign

Recommended Posts

The last week I have been having many problems when coding with php. I am not sure if it is a problem with my host. Here is the sort of problems I have been having:

 

//=================index.php
$test = 1;
echo "Main page test =".$test;
// ouputs Main page test = 1 fine

include 'header.php';
// ouputs Header test =  where is the variable going?

//==================header.php
echo "Header test =".$test;

Not sure why header.php isn't picking up the variable?

Another problem I am having is including connect.php in my page, just does't work. If I take the content of connect.php and place it above my query it works fine. Don't know what is going on.

//===================connect.php

$username="user";
$password="pass";
$database="my_database";

mysql_connect(localhost,$username,$password);

@mysql_select_db($database) or die( "Unable to select database");

 

Does anybody have any ideas of what the problem might be?

Link to comment
https://forums.phpfreaks.com/topic/152825-is-this-a-problem-with-the-server/
Share on other sites

are you sure the location of connect.php and header.php are where your include() is trying to fetch them from?

 

try an absolute path, starting from the very root of your server .. an example might be:

include ("/home/wemustdesign/public_html/connect.php");

 

you can find this via a phpinfo.php file .. under Environment > DOCUMENT_ROOT;

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.