Hi!
I'm having a spot of very annoying trouble.
I'm using PHP and mySQL, and I have the following page:
PHP Code:
<?
// You may copy this PHP section to the top of file which needs to access after login.
session_start(); // Use session variable on this page. This function must put on the top of page.
if(!session_is_registered("username")){ // if session variable "username" does not exist.
header("location:index.php"); // Re-direct to index.php
}
include('db.php');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="stylesheet.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>TSS Inventory</title>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="496" height="109"><img src="http://forums.techguy.org/images/topleft.gif" width="496" height="109"></td>
<td height="84" background="http://forums.techguy.org/images/topbg.gif"><div align="right"> </div></td>
</tr>
</table></td>
</tr>
<tr>
<td background="http://forums.techguy.org/images/navbg.gif" ><? include ('nav.php'); ?></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="181" class="leftbg" bgcolor="FFFFCC" valign="top"><? include ('left_main.php'); ?></td>
<td class="rightbg" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="23" class="maintxt">
<tr>
<td class="maintxt"><p><strong>Blocks <? echo $msg; ?><br>
</strong>Although this may rarely be used, it is useful if you have had an extension or renaming of the school.</p>
<form name="form1" method="post" action="addblock_post.php">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="middle"><strong>Block:
<input type="text" name="test">
<input type="submit" name="Submit" value="Add New Block">
</strong></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</table>
</form>
<p><strong>Current Blocks </strong></p>
<table>
<?
$query = "SELECT * FROM blocks";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
?>
<tr>
<td><font color="#006600"><b><? echo ($row['block']); ?></b></font></td>
<td width="141"><a href="addblock_delete.php?id=<? echo ($row['block_id']); ?>" class="left">Delete</a></td>
</tr>
<?
}
mysql_close();
?>
</table>
</p></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td background="http://forums.techguy.org/images/navbg.gif"><? include ('nav.php'); ?></td>
</tr>
</table>
</body>
</html>
Excuse me if my coding is a little messy.
This page lists all the blocks in a school, and has a "delete" link next to them. This delete link has the block's ID tagged to it like so .....
PHP Code:
"><a href="addblock_delete.php?id=<? echo ($row['block_id']); ?>" class="left">Delete</a>
When the user clicks to delete the block from the database, it directs to the next page:
PHP Code:
<?
// You may copy this PHP section to the top of file which needs to access after login.
session_start(); // Use session variable on this page. This function must put on the top of page.
if(!session_is_registered("username")){ // if session variable "username" does not exist.
header("location:index.php"); // Re-direct to index.php
}
include('db.php');
if($y){
echo $_GET['id'];
$id = $_GET['id'];
echo $id;
// Connect database.
include('db.php');
mysql_query("DELETE FROM blocks WHERE `block_id` = '$id' LIMIT 1");
///("UPDATE equipment_models (equipment_model, equipment_type) VALUES ('$equipment_model', '$equipment_type') WHERE equipment_model_id = '$id'")or die(mysql_error());
mysql_close();
$msg = "<font color=red> - The Block Has Been Deleted</font>";
include('addblock.php');
}else{
$id = $_GET['id'];
?>
<link href="stylesheet.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
-->
</style>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="stylesheet.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>TSS Inventory</title>
<style type="text/css">
<!--
.style7 {
color: #006600;
font-weight: bold;
}
.style8 {
color: #0000FF;
font-weight: bold;
}
-->
</style>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="496" height="109"><img src="http://forums.techguy.org/images/topleft.gif" width="496" height="109"></td>
<td height="84" background="http://forums.techguy.org/images/topbg.gif"><div align="right"> </div></td>
</tr>
</table></td>
</tr>
<tr>
<td background="http://forums.techguy.org/images/navbg.gif"><? include ('nav.php'); ?></td>
</tr>
<tr>
<td class="leftbg"><table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" class="leftbg">
<tr>
<td width="181" class="leftbg" bgcolor="FFFFCC" valign="top"><? include ('left_admin.php'); ?></td>
<td class="rightbg" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="23" class="maintxt">
<tr>
<td class="maintxt" name="location">
<div align="center">
<div align="center" class="style1">Are you sure you want to delete this entry?<br>
<a href="addblock_delete.php?y=1&id=<? echo $id; ?>">Yes</a> - <a href="javascript:javascript:history.go(-1)">No</a>
</div>
</div></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td background="http://forums.techguy.org/images/navbg.gif"><? include ('nav.php'); ?></td>
</tr>
</table>
</body>
</html><?
}
?>
The problem is, when I run this page via my memory stick which has a server running from it, it runs fine. The block deletes without an issue... But when its uploaded to the schools server, it does not!
When you click "yes" to confirm the delete of the block, the page appears to just flicker, and nothing happens. Nothing gets deleted, there are no confirmations about the file being deleted either.
These are the details:
LOCALHOST:
MySQL client version: 5.0.18
PHP Version 5.2.3
SCHOOL SERVER:
MySQL client version: 5.0.45
PHP Version 5.2.5
I've been trying for hours and I'm so stuck! Is there a light at the end of this tunnel?
*******UPDATE, attached are the two phpinfo files from the localhost and server.**************
Nick