Link to home
Start Free TrialLog in
Avatar of usmansultan
usmansultanFlag for Australia

asked on

PHP and MySQL errors during Website Transition

We are on a phase of transferring the website and database from an old webhost to a new one, now in the transition stage i am getting few errors on MYSQL and PHP, i am pasting the errors, hopefully someone can help me out.
Right now i have a test link provided by netregistry which is http://rere6659.staging-zeus.netregistry.net/ 
now if you click on Announcement page you will see the error codes, as well as on the Support Centre and on the Knowledge base it takes you to the live website, not to the current one.
<?php
 
include_once '../admin/db.php';
include_once '../admin/common.php';
 
?>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
<!-- Site Copyright 2006 Response Systems -->
 
<head>
	<meta name="author" content="Hadley Grindrod" />
	<meta http-equiv="content-type" content="text/html;charset=iso-8859-2" />
<link rel="stylesheet" href="../style.css" type="text/css" />
<title>Response Systems :: Announcements</title>
</head>
 
<!-- Begin Site Body -->
 
<body>
	<div class="content">
	
	<!-- Begin Header Section -->
	
		<div class="header_top"></div>
		<div class="header">
		
		<!-- Begin Navigation Bar -->
		
			<div class="header_right">
				<div id="nav">
    				<p><a href="../solutions/">Solutions</a> | <a href="../support/">Support</a> | <a href="../links/">Links</a> | <a href="../contact/">Contact</a></p>
				</div>
	<div class="header_search">
<form method="get" action="http://response-systems.com/cgi-bin/search/search.pl">
			<p><input type="text" name="Terms" class="search" /> <input type="submit" value="Search" class="submit" /></p>
					</form>
				</div>
			</div>
			
		<!-- Begin Logo Placement -->
			
			<div class="header_left">
				<a href="../"><img src="../images/responselogo.jpg" alt="Home" /></a>
			</div>
		
	<!-- Finish Header Section -->	
				
		</div>
		
		<div class="header_bottom"></div>
		<div class="spacer"></div>
		
	<!-- Begin Content Area -->
		
		<div class="header_top"></div>
		
		<!-- Column 1 : Left : News Links -->
		
		<div class="column">
			<div class="box_top">
				<h2>Announcements</h2>
			</div>	
<?php
 
dbConnect("rs_response_systems_com");
 
$sql = "SELECT * FROM announcements ORDER BY id DESC LIMIT 3";
$result = mysql_query($sql);
 
$i=0;
	while ($i < 3) {
		$subject = mysql_result($result,$i,"subject");
		$subtitle = mysql_result($result,$i,"subtitle");
		$i++;
		if ($subject != "") {
?>			
			<div class="box_icon">	
				<a href="index.php#news_item<? echo $i ;?>"><img src="../images/icons/news<? echo $i ;?>.gif" width="50" alt="<? echo $subject; ?>" /></a>
				<h2><a href="index.php#news_item<? echo $i ;?>"><? echo $subject; ?></a></h2>
				<p><a href="index.php#news_item<? echo $i ;?>"><? echo $subtitle; ?></a></p>
			</div>
			
<?
		}
	}
 
?>
			<div class="box_bottom"></div>
		</div>
		
		<!-- Column 2 : Right : Content -->
		
		<div class="column2">
			<h2>Announcements</h2>
 
<?
			
	$i=0;
 
	while ($i < 3) {
		$subject = mysql_result($result,$i,"subject");
		$content = mysql_result($result,$i,"content");
		$i++;
		
?>
			<!-- News Item <? echo $i ;?> -->
			
			<p id="news_item<? echo $i ;?>"><b><? echo $subject; ?></b></p>
			<p><? echo nl2br($content); ?></p>
			
<?
 
	}
 
?>
		
		</div>
 
	<!-- Finish Content Area -->
		
		<div class="header_bottom"></div>
		
	<!-- Begin Footer -->
		
		<div class="language">
			<a href="../fr/"><img src="../images/Language/France.png" alt="French" /></a>
			<a href="../de/"><img src="../images/Language/Germany.png" alt="German" /></a>
			<a href="../es/"><img src="../images/Language/Spain.png" alt="Spanish" /></a>
		</div>
		<div class="footer">
			<p><a href="../about/">About Response Systems</a> | <a href="../privacy/">Privacy</a> | <a href="../enquiry/">Feedback</a> | <a href="../contact/">Contact</a><br />
			&copy; Copyright 2006 Response Systems</p>
		</div>
	</div>
</body>
</html>
 
Open in New Window

Open in new window

Avatar of usmansultan
usmansultan
Flag of Australia image

ASKER

I havent made any changes in the code, during the migration.
Avatar of rajuniit
rajuniit

first of all  make sure that u have data in this table.
because this error can arise when result set is null.

plz see the code snippet.it can help u.
instead of ur line 74 to 88's code u can try this.
if it work then u have change line 103 to 116 also.
i also give u a txt file where all the modification code have.


while($row = mysql_fetch_assoc($result))
{
    $subject = $row['subject'];//make change here
    $subtitle = $row['subtitle'];//make change here
    if ($subject != "") 
	{
?>                      
    	<div class="box_icon">  
        <a href="index.php#news_item<? echo $i ;?>">
		<img src="../images/icons/news<? echo $i ;?>.gif" width="50" alt="<? echo $subject; ?>" /></a>
        <h2><a href="index.php#news_item<? echo $i ;?>"><? echo $subject; ?></a></h2>
        <p><a href="index.php#news_item<? echo $i ;?>"><? echo $subtitle; ?></a></p>
        </div>
<?
    }
    
}

Open in new window

index.txt
So i am going to replace the index file with yours.....
I have replaced the code with yours, but now under announcement its not showing any errors, but its not showing any text as well, and if you want to get a liittle bit more in dept information about this question, you can view it on
https://www.experts-exchange.com/questions/23455399/How-do-i-link-Web-Pages-with-PHP.html 
I am pasting the code again in case if you have missed somethig..
<?php
 
include_once '../admin/db.php';
include_once '../admin/common.php';
 
?>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
<!-- Site Copyright 2006 Response Systems -->
 
<head>
	<meta name="author" content="Hadley Grindrod" />
	<meta http-equiv="content-type" content="text/html;charset=iso-8859-2" />
	<link rel="stylesheet" href="../style.css" type="text/css" />
	<title>Response Systems :: Announcements</title>
</head>
 
<!-- Begin Site Body -->
 
<body>
	<div class="content">
	
	<!-- Begin Header Section -->
	
		<div class="header_top"></div>
		<div class="header">
		
		<!-- Begin Navigation Bar -->
		
			<div class="header_right">
				<div id="nav">
    				<p><a href="../solutions/">Solutions</a> | <a href="../support/">Support</a> | <a href="../links/">Links</a> | <a href="../contact/">Contact</a></p>
				</div>
				<div class="header_search">
					<form method="get" action="http://response-systems.com/cgi-bin/search/search.pl">
						<p><input type="text" name="Terms" class="search" /> <input type="submit" value="Search" class="submit" /></p>
					</form>
				</div>
			</div>
			
		<!-- Begin Logo Placement -->
			
			<div class="header_left">
				<a href="../"><img src="../images/responselogo.jpg" alt="Home" /></a>
			</div>
		
	<!-- Finish Header Section -->	
				
		</div>
		
		<div class="header_bottom"></div>
		<div class="spacer"></div>
		
	<!-- Begin Content Area -->
		
		<div class="header_top"></div>
		
		<!-- Column 1 : Left : News Links -->
		
		<div class="column">
			<div class="box_top">
				<h2>Announcements</h2>
			</div>	
<?php
 
dbConnect("rs_response_systems_com");
 
$sql = "SELECT * FROM announcements ORDER BY id DESC LIMIT 3";
$result = mysql_query($sql);
 
$i=0;
	while ($i < 3) {
		$subject = mysql_result($result,$i,"subject");
		$subtitle = mysql_result($result,$i,"subtitle");
		$i++;
		if ($subject != "") {
?>			
			<div class="box_icon">	
				<a href="index.php#news_item<? echo $i ;?>"><img src="../images/icons/news<? echo $i ;?>.gif" width="50" alt="<? echo $subject; ?>" /></a>
				<h2><a href="index.php#news_item<? echo $i ;?>"><? echo $subject; ?></a></h2>
				<p><a href="index.php#news_item<? echo $i ;?>"><? echo $subtitle; ?></a></p>
			</div>
			
<?
		}
	}
 
?>
			<div class="box_bottom"></div>
		</div>
		
		<!-- Column 2 : Right : Content -->
		
		<div class="column2">
			<h2>Announcements</h2>
 
<?
			
	$i=0;
 
	while ($i < 3) {
		$subject = mysql_result($result,$i,"subject");
		$content = mysql_result($result,$i,"content");
		$i++;
		
?>
			<!-- News Item <? echo $i ;?> -->
			
			<p id="news_item<? echo $i ;?>"><b><? echo $subject; ?></b></p>
			<p><? echo nl2br($content); ?></p>
			
<?
 
	}
 
?>
		
		</div>
 
	<!-- Finish Content Area -->
		
		<div class="header_bottom"></div>
		
	<!-- Begin Footer -->
		
		<div class="language">
			<a href="../fr/"><img src="../images/Language/France.png" alt="French" /></a>
			<a href="../de/"><img src="../images/Language/Germany.png" alt="German" /></a>
			<a href="../es/"><img src="../images/Language/Spain.png" alt="Spanish" /></a>
		</div>
		<div class="footer">
			<p><a href="../about/">About Response Systems</a> | <a href="../privacy/">Privacy</a> | <a href="../enquiry/">Feedback</a> | <a href="../contact/">Contact</a><br />
			&copy; Copyright 2006 Response Systems</p>
		</div>
	</div>
</body>
</html>

Open in new window

I have tried your code it took out the error, but it took out the icons and there links as well, means when you click on Announcements page, the two icon that appear on the left pane are gone......
I have fixed it, i made the counter i <2, and it worked....but i trying to sort out the errors on the other pages, like when you click on knowledge base why does it take you to live website.......
see,u set ur knowledgebase pages link for live website.so undoubtly it will take u to live website.
sorry for late reply, got busy on other tasks,
Anyways i am having problem on the Support Centre page, when anyone logs in and tries to download anything, it doesnt carry through the session, its logs the user out, i think it has to do with the Session Start() function, i might be wrong, but i thnk it needs to be defined in the start, whats the syntax of this function,
and i have 4 php files so where should i define it.
I have Access.php, Common.php, db.php,index.php, logout.php and password.php under support folder.
So on which php files that function needs to be defined or is there any other solution for that.......
I know where the problem is, but i am not able to fix it, its with the session start () function, but i am not sure why its not wroking, i am pasting the code here.
<?php // access.php
 
include_once 'common.php';
include_once 'db.php';
session_start();
 
// Make Changes here, took out session_start() which was generating the error
 
$uid = isset($_POST['uid']) ? $_POST['uid'] : $_SESSION['uid'];
$pwd = isset($_POST['pwd']) ? $_POST['pwd'] : $_SESSION['pwd'];
 
if(!isset($uid)) {
	?>
	
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
<!-- Site Copyright 2006 Response Systems -->
 
<head>
	<meta name="author" content="Hadley Grindrod" />
	<meta http-equiv="content-type" content="text/html;charset=iso-8859-2" />
	<link rel="stylesheet" href="../../style.css" type="text/css" />
	<title>Response Systems :: Support Centre</title>
</head>
 
<!-- Begin Site Body -->
 
<body>
	<div class="content">
	
	<!-- Begin Header Section -->
	
		<div class="header_top"></div>
		<div class="header">
		
		<!-- Begin Navigation Bar -->
		
			<div class="header_right">
				<div id="nav">
    				<p><a href="../../solutions/">Solutions</a> | <a href="../">Support</a> | <a href="../../links/">Links</a> | <a href="../../contact/">Contact</a></p>
				</div>
				<div class="header_search">
					<form method="get" action="http://response-systems.com/cgi-bin/search/search.pl">
						<p><input type="text" name="Terms" class="search" /> <input type="submit" value="Search" class="submit" /></p>
					</form>
				</div>
			</div>
			
		<!-- Begin Logo Placement -->
			
			<div class="header_left">
				<a href="../../"><img src="../../images/responselogo.jpg" alt="Home" /></a>
			</div>
		
	<!-- Finish Header Section -->	
			
		</div>
		
		<div class="header_bottom"></div>
		<div class="spacer"></div>
		
	<!-- Begin Content Area -->
		
		<div class="header_top"></div>
		
		<!-- Column 1 : Left : Log In -->
		
		<div class="column">
			<div class="box_top">
				<h2>Log In:</h2>
			</div>	
			<div class="box">
			  	<form method="post" action="<?=$_SERVER['PHP_SELF']?>">
			    	<h1>Username</h1>
			       	<h1><input type="text" name="uid" class="user" /></h1>
			       	<h1>&nbsp;</h1>
			       	<h1>Password</h1>
					<h1><input type="password" name="pwd" class="pass" /></h1>
		      		<h1><input type="submit" value="Log In" name="login" class="login" /></h1>
					<p><a href="password.php">Forgotten Your Login?</a></p>
				</form>
			</div>
			<div class="box_bottom"></div>
		</div>
		
		<!-- Column 2 : Right : Content -->
		
		<div class="column2">
			<h2>Support Centre</h2>
			<p>Welcome to the Response Systems Support Centre. Log in for access to Downloads, Updates, and Support Requests. Please check first to make sure that your question hasn't already been answered by checking our <a href="http://www.response-systems.com/cgi-bin/knowledgebase/search.pl?Terms=articles">knowledgebase</a>.</p>
			<p>For system requirements or latest release information, please go to the <a href="../../solutions/">Solutions</a> section and select the product you which to check.</p>
			<p><a href="apply/">Click here to apply for access to the Support Centre.</a></p>
		</div>
		
	<!-- Finish Content Area -->
		
		<div class="header_bottom"></div>
		
	<!-- Begin Footer -->
		
		<div class="language">
			<a href="../../fr/"><img src="../../images/Language/France.png" alt="French" /></a>
			<a href="../../de/"><img src="../../images/Language/Germany.png" alt="German" /></a>
			<a href="../../es/"><img src="../../images/Language/Spain.png" alt="Spanish" /></a>
		</div>
		<div class="footer">
			<p><a href="../../about/">About Response Systems</a> | <a href="../../privacy/">Privacy</a> | <a href="../../enquiry/">Feedback</a> | <a href="../../contact/">Contact</a><br />
			&copy; Copyright 2006 Response Systems</p>
		</div>
	</div>
</body>
</html>
 
<?php
 
	exit;
}
 
$_SESSION['uid'] = $uid;
$_SESSION['pwd'] = $pwd;
 
dbConnect("rs_response_systems_com");
$sql = "SELECT * FROM users WHERE user = '$uid' AND pass = '$pwd'";
$result = mysql_query($sql);
 
if (!$result) {
	error('A database error occurred while checking your login details.\\nIf this error persists, please contact the webmaster');
}
 
if (mysql_num_rows($result) == 1 && isset($_POST['login'])) {
	$count = mysql_result($result,0,"count");
	$count++;
	$date = date("y,m,d");
	$query = "UPDATE users SET count ='$count', last = '$date' WHERE user = '$uid'";
	mysql_query($query);
}
 
if (mysql_num_rows($result) == 0) {
	unset($_SESSION['uid']);
	unset($_SESSION['pwd']);
	
?>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
<!-- Site Copyright 2006 Response Systems -->
 
<head>
	<meta name="author" content="Hadley Grindrod" />
	<meta http-equiv="content-type" content="text/html;charset=iso-8859-2" />
	<link rel="stylesheet" href="../../style.css" type="text/css" />
	<title>Response Systems :: Support</title>
</head>
 
<!-- Begin Site Body -->
 
<body>
	<div class="content">
	
	<!-- Begin Header Section -->
	
		<div class="header_top"></div>
		<div class="header">
		
		<!-- Begin Navigation Bar -->
		
			<div class="header_right">
				<div id="nav">
    				<p><a href="../../solutions/">Solutions</a> | <a href="../">Support</a> | <a href="../../links/">Links</a> | <a href="../../contact/">Contact</a></p>
				</div>
				<div class="header_search">
					<form method="get" action="http://response-systems.com/cgi-bin/search/search.pl">
						<p><input type="text" name="Terms" class="search" /> <input type="submit" value="Search" class="submit" /></p>
					</form>
				</div>
			</div>
			
		<!-- Begin Logo Placement -->
			
			<div class="header_left">
				<a href="../../"><img src="../../images/responselogo.jpg" alt="Home" /></a>
			</div>
		
	<!-- Finish Header Section -->	
 
		</div>
		
		<div class="header_bottom"></div>
		<div class="spacer"></div>
		
	<!-- Begin Content Area -->
		
		<div class="header_top"></div>
		
		<!-- Column 1 : Left : Log In -->
		
		<div class="column">
			<div class="box_top">
				<h2>Log In:</h2>
			</div>	
			<div class="box">
			  	<form method="post" action="<?=$_SERVER['PHP_SELF']?>">
			    	<h1>Username</h1>
			       	<h1><input type="text" name="uid" class="user" /></h1>
			       	<h1>&nbsp;</h1>
			       	<h1>Password</h1>
					<h1><input type="password" name="pwd" class="pass" /></h1>
		      		<h1><input type="submit" value="Log In" class="login" /></h1>
					<p><a href="#">Forgot Your Password?</a></p>
				</form>
			</div>
			<div class="box_bottom"></div>
		</div>
		
		<!-- Column 2 : Right : Content -->
		
		<div class="column2">
			<h2>Support Centre</h2>
			<p>The login details you supplied are incorrect. Please try again.</p>
			<p><a href="apply/">Click here to apply for access</a></p>
		</div>
		
	<!-- Finish Content Area -->
		
		<div class="header_bottom"></div>
		
	<!-- Begin Footer -->
		
		<div class="language">
			<a href="../../fr/"><img src="../../images/Language/France.png" alt="French" /></a>
			<a href="../../de/"><img src="../../images/Language/Germany.png" alt="German" /></a>
			<a href="../../es/"><img src="../../images/Language/Spain.png" alt="Spanish" /></a>
		</div>
		<div class="footer">
			<p><a href="../../about/">About Response Systems</a> | <a href="../../privacy/">Privacy</a> | <a href="../../contact/">Contact</a><br />
			&copy; Copyright 2006 Response Systems</p>
		</div>
	</div>
</body>
</html>
 
<?php
	exit;
}
?>

Open in new window

its giving an error on line 5, and the error is:
"Fatal error: session_start() [<a href='function.session-start'>function.session-start</a>]: Failed to initialize storage module: user (path: /tmp) in /clientdata/clients/r/e/response-systems.com/www/support/centre/access.php on line 5"
ASKER CERTIFIED SOLUTION
Avatar of usmansultan
usmansultan
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial