Solved

PHP session start causes runtime error in IE 7

Posted on 2010-11-26
6
383 Views
Last Modified: 2012-05-10
Hi
I have a page that starts with
<?php
session_start();
?>

All works fine in Chrome and Mozilla but in IE7 I get a 'runtime error occurred on line 2. Object not supported. I'm developing it on Xampp locally if that's relevant.

Any ideas please? (I can post more code if it's not a common issue).

Thank you
0
Comment
Question by:swordfishsoup
[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
  • 4
  • 2
6 Comments
 
LVL 6

Expert Comment

by:i-CONICA
ID: 34216565
A PHP runtime error or config issue shouldn't be browser dependent... Can you post more code, what else is going out to the browser, if anything? Try echoing something after session_start() and see if it's outputted properly in Chrome or FF.
0
 

Author Comment

by:swordfishsoup
ID: 34216643
Hi. Thanks for looking. I'm attaching the code down to the end of the Head. Yeah it is fine on all excpet IE7.
Thanks again.
<?php
session_start();
?>
<?php require_once('../Connections/burnerphp.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_burnerphp, $burnerphp);
$query_RsReferer = "SELECT * FROM tblreferers";
$RsReferer = mysql_query($query_RsReferer, $burnerphp) or die(mysql_error());
$row_RsReferer = mysql_fetch_assoc($RsReferer);
$totalRows_RsReferer = mysql_num_rows($RsReferer);

$media_RsMaster = "1";
if (isset($_SESSION['frmmedia'])) {
  $media_RsMaster = $_SESSION['frmmedia'];
}
$dupe_RsMaster = "3";
if (isset($_SESSION['frmdupe'])) {
  $dupe_RsMaster = $_SESSION['frmdupe'];
}
$print_RsMaster = "6";
if (isset($_SESSION['frmprint'])) {
  $print_RsMaster = $_SESSION['frmprint'];
}
$pack_RsMaster = "12";
if (isset($_SESSION['frmpack'])) {
  $pack_RsMaster = $_SESSION['frmpack'];
}
$paper_RsMaster = "17";
if (isset($_SESSION['frmpaper'])) {
  $paper_RsMaster = $_SESSION['frmpaper'];
}
$paperextra_RsMaster = "22";
if (isset($_SESSION['frmpaperextra'])) {
  $paperextra_RsMaster = $_SESSION['frmpaperextra'];
}
mysql_select_db($database_burnerphp, $burnerphp);
$query_RsMaster = sprintf("SELECT tblsiteproducts.ProductID, tblsiteproducts.ProductName, tblsiteproducts.class, tblsiteproducts.Price, tblsiteproducts.ProdImg FROM tblsiteproducts WHERE tblsiteproducts.ProductID = %s OR tblsiteproducts.ProductID = %s OR tblsiteproducts.ProductID = %s OR tblsiteproducts.ProductID = %s OR tblsiteproducts.ProductID = %s OR tblsiteproducts.ProductID = %s", GetSQLValueString($media_RsMaster, "int"),GetSQLValueString($dupe_RsMaster, "int"),GetSQLValueString($print_RsMaster, "int"),GetSQLValueString($pack_RsMaster, "int"),GetSQLValueString($paper_RsMaster, "int"),GetSQLValueString($paperextra_RsMaster, "int"));
$RsMaster = mysql_query($query_RsMaster, $burnerphp) or die(mysql_error());
$row_RsMaster = mysql_fetch_assoc($RsMaster);
$totalRows_RsMaster = mysql_num_rows($RsMaster);

mysql_select_db($database_burnerphp, $burnerphp);
$query_RsDelivery = "SELECT ProductID, ProductName, Price FROM tblSiteProducts WHERE ProductID = 33 OR ProductID = 34";
$RsDelivery = mysql_query($query_RsDelivery, $burnerphp) or die(mysql_error());
$row_RsDelivery = mysql_fetch_assoc($RsDelivery);
$totalRows_RsDelivery = mysql_num_rows($RsDelivery);

mysql_select_db($database_burnerphp, $burnerphp);
$query_RsBase = "SELECT * FROM tblbase";
$RsBase = mysql_query($query_RsBase, $burnerphp) or die(mysql_error());
$row_RsBase = mysql_fetch_assoc($RsBase);
$totalRows_RsBase = mysql_num_rows($RsBase);

$media_RsPrice = "1";
if (isset($_SESSION['frmmedia'])) {
  $media_RsPrice = $_SESSION['frmmedia'];
}
$dupe_RsPrice = "4";
if (isset($_SESSION['frmdupe'])) {
  $dupe_RsPrice = $_SESSION['frmdupe'];
}
$print_RsPrice = "5";
if (isset($_SESSION['frmprint'])) {
  $print_RsPrice = $_SESSION['frmprint'];
}
$pack_RsPrice = "8";
if (isset($_SESSION['frmpack'])) {
  $pack_RsPrice = $_SESSION['frmpack'];
}
$paper_RsPrice = "17";
if (isset($_SESSION['frmpaper'])) {
  $paper_RsPrice = $_SESSION['frmpaper'];
}
$paperextra_RsPrice = "22";
if (isset($_SESSION['frmpaperextra'])) {
  $paperextra_RsPrice = $_SESSION['frmpaperextra'];
}
mysql_select_db($database_burnerphp, $burnerphp);
$query_RsPrice = sprintf("SELECT sum( tblsiteproducts.Price ) as total_price  FROM tblsiteproducts WHERE tblsiteproducts.ProductID = %s OR tblsiteproducts.ProductID = %s OR tblsiteproducts.ProductID = %s OR tblsiteproducts.ProductID = %s OR tblsiteproducts.ProductID = %s OR tblsiteproducts.ProductID = %s", GetSQLValueString($media_RsPrice, "int"),GetSQLValueString($dupe_RsPrice, "int"),GetSQLValueString($print_RsPrice, "int"),GetSQLValueString($pack_RsPrice, "int"),GetSQLValueString($paper_RsPrice, "int"),GetSQLValueString($paperextra_RsPrice, "int"));
$RsPrice = mysql_query($query_RsPrice, $burnerphp) or die(mysql_error());
$row_RsPrice = mysql_fetch_assoc($RsPrice);
$totalRows_RsPrice = mysql_num_rows($RsPrice);
?>
<?php $_SESSION['unitcost']=$row_RsPrice['total_price']; ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Complexity HTML Theme</title>
<!--db start-->
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<link href="../css/basic.css" rel="stylesheet" type="text/css" />
<link href="../css/contact.css" rel="stylesheet" type="text/css" />

<!--IE 6 "fixes"-->
<!--[if lt IE 7]>
<link type='text/css' href='css/basic_ie.css' rel='stylesheet' media='screen' />
<![endif]-->
<script type="text/javascript" language="javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2/jquery.min.js"></script>
<script type='text/javascript' src='../JScript/contact.js'></script>
<!-- db end -->
<!-- SEO -->
<meta name="keywords" content="keyword 1, keyword 2, keyword 3, keyword 4" />
<meta name="description" content="Put a description of your site here for the Search Engines." />

<!-- JS -->
<!--<script type="text/javascript" src="../../layout/js/jquery.js"></script>-->
<script type="text/javascript" src="../../layout/js/cycle.js"></script>
<script type="text/javascript" src="../../layout/js/hoverIntent.js"></script>
<script type="text/javascript" src="../../layout/js/superfish.js"></script>
<script type="text/javascript" src="../../layout/plugins/prettyphoto/js/jquery.prettyPhoto.js"></script>
<script type="text/javascript" src="../../layout/js/validate.js"></script>
<script type="text/javascript" src="../../layout/js/custom.js"></script>

<script language="javascript" type="text/javascript" src="../JScript/pricing.js"></script>
<script language="javascript" type="text/javascript" src="../JScript/check.js"></script>

<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../../layout/css/reset.css" />
<link rel="stylesheet" type="text/css" href="../../layout/plugins/prettyphoto/css/prettyPhoto.css" />
<link rel="stylesheet" type="text/css" href="../../style.css" />

<!-- Specific Style -->
<link rel="stylesheet" type="text/css" href="../../layout/css/style1.css" />

<!--[if IE 6]>
<script type='text/javascript' src='layout/js/dd_belated_png.js'></script>
<script>DD_belatedPNG.fix('.ie6');</script>
<![endif]-->

<!-- Slideshow Nav -->
<script type="text/javascript">
function paginate(idx, slide){	
	return '<a href="" title="" class="ie6"><img src="layout/images/transparent.png" alt="" class="ie6" /></a>';
}
</script>

</head>

Open in new window

0
 

Author Comment

by:swordfishsoup
ID: 34217340
I disabled script debugging in Internet Explorer which has solved the issue for me. But I'm still unsure why the error came up in the first place. And does anyone know if debugging will be 'off' in the general public versions of IE7?
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 6

Accepted Solution

by:
i-CONICA earned 500 total points
ID: 34217529
This is not a problem with your PHP code (which I can't fully test because I don't have that included file). It's a problem with your Javascript. As said, a server side error can't be browser dependent. So it's got to be client side, aka the javascript.

IE can be a bugger with subtle JS errors, run all JS through JSLint to see if it gives you any problems to fix... I'm not a JS expert so can't really offer much advice on that, but it's definatley not a problem with your PHP.

Ps, why do you end PHP and restart it on lines 3/4 and 4/5? There's no need. All you're doing there is starting to send content to the browser, that new line has to be sent, along with headers, meaning you can't modify them beyond that point... Keep it all in PHP until you need to send out content. :)
0
 

Author Comment

by:swordfishsoup
ID: 34217689
Thanks for that advice. I'll check the Jquery and report back.
as for
why do you end PHP and restart it on lines 3/4 and 4/5?
Because I tend to have to work it all out as I go along and didn't do any basic training - Costs me hours, good job I'm stubborn. Thanks, I'll correct that though.
0
 

Author Comment

by:swordfishsoup
ID: 34217749
Hi
You were dead right. It was one of the Js files. I've tidied up the PHP too.
Thanks again for your help.
Dave
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

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
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

738 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