Hi,
I need to seperate my connection statements
<?
$db = mysql_connect("localhost", "something","somethingelse"
;
mysql_select_db("something",$db);
?>
and all my other codes in another page. I want to do this because I don't want to change every page everytime I change the database password.
So I seperated the above code, and include it in all of my pages. The problem is, some pages worked, some pages don't. Although I included them the same way
using the normal
include("
It's not supposed to be directory problem, some pages that have the problems are in the same directory with connectme.php and some pages that doesn't work are not in the same directory.
Here's a code snippet that works
<?php
session_start();
if($_SESSION["loginid"]){
$loginname=$_SESSION["loginid"];
include ("
$sql = "Select * from msg where posttime ='$ts' and recipient='$loginname'";
$result = mysql_query($sql) or die ("Could not execute query: $query. " . mysql_error());
$mailrow= mysql_fetch_array($result);
Here's a code snippet that doesn't work
<?php
session_start();
if ($_SESSION['loginid'])
{
$loginname = $_SESSION['loginid'];
include ("
$sql = "Select * from set where loginname = '$loginname'";
$resultset = mysql_query($sql);
Does anyone has any idea? Or is there any better way to do it?
Regards,
Namida
I need to seperate my connection statements
<?
$db = mysql_connect("localhost", "something","somethingelse"
mysql_select_db("something",$db);
?>
and all my other codes in another page. I want to do this because I don't want to change every page everytime I change the database password.
So I seperated the above code, and include it in all of my pages. The problem is, some pages worked, some pages don't. Although I included them the same way
using the normal
include("
It's not supposed to be directory problem, some pages that have the problems are in the same directory with connectme.php and some pages that doesn't work are not in the same directory.
Here's a code snippet that works
<?php
session_start();
if($_SESSION["loginid"]){
$loginname=$_SESSION["loginid"];
include ("
$sql = "Select * from msg where posttime ='$ts' and recipient='$loginname'";
$result = mysql_query($sql) or die ("Could not execute query: $query. " . mysql_error());
$mailrow= mysql_fetch_array($result);
Here's a code snippet that doesn't work
<?php
session_start();
if ($_SESSION['loginid'])
{
$loginname = $_SESSION['loginid'];
include ("
$sql = "Select * from set where loginname = '$loginname'";
$resultset = mysql_query($sql);
Does anyone has any idea? Or is there any better way to do it?
Regards,
Namida