Solved

PHP and MySQL errors during Website Transition

Posted on 2008-06-11
12
484 Views
Last Modified: 2013-12-13
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

0
Comment
Question by:usmansultan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 2
12 Comments
 
LVL 1

Author Comment

by:usmansultan
ID: 21765952
I havent made any changes in the code, during the migration.
0
 

Expert Comment

by:rajuniit
ID: 21766247
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
0
 
LVL 1

Author Comment

by:usmansultan
ID: 21766398
So i am going to replace the index file with yours.....
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 1

Author Comment

by:usmansultan
ID: 21766459
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
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/PHP_Databases/Q_23455399.html 
0
 
LVL 1

Author Comment

by:usmansultan
ID: 21766481
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

0
 
LVL 1

Author Comment

by:usmansultan
ID: 21766544
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......
0
 
LVL 1

Author Comment

by:usmansultan
ID: 21766815
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.......
0
 

Expert Comment

by:rajuniit
ID: 21766892
see,u set ur knowledgebase pages link for live website.so undoubtly it will take u to live website.
0
 
LVL 1

Author Comment

by:usmansultan
ID: 21790995
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.......
0
 
LVL 1

Author Comment

by:usmansultan
ID: 21827921
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

0
 
LVL 1

Author Comment

by:usmansultan
ID: 21827926
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"
0
 
LVL 1

Accepted Solution

by:
usmansultan earned 0 total points
ID: 22100199
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question