blank HTML displaying from simple script. [solved]
Posted: Sat Sep 22, 2007 7:56 pm
Hello good people,
I have started a script, to allow for deleting related records from my DB. What the sript does really doesn't matter though, the issue is that
when this script is called via a link from another page where the url is assembled from a variable it displays nothing. The URL is as it should be:
http://localhost/Studio_manager/act_delete.php?sid=91
When I look at the source HTML I see:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
<BODY></BODY></HTML>
I have just added some text to my external include file which serves as an HTML header.
The script isn't running at all. Yet I'm not getting a 404 error or anything like that. I recently changed my PHP.ini setting to show all errors.
All my other scripts are running fine.
There is most likely something very obvious that is wrong with this script, but I'm not seeing it.
Any help is greatly appreciated.
I'm going to try restarting my pc. I'm so lost!
here's the script
I have started a script, to allow for deleting related records from my DB. What the sript does really doesn't matter though, the issue is that
when this script is called via a link from another page where the url is assembled from a variable it displays nothing. The URL is as it should be:
http://localhost/Studio_manager/act_delete.php?sid=91
When I look at the source HTML I see:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
<BODY></BODY></HTML>
I have just added some text to my external include file which serves as an HTML header.
The script isn't running at all. Yet I'm not getting a 404 error or anything like that. I recently changed my PHP.ini setting to show all errors.
All my other scripts are running fine.
There is most likely something very obvious that is wrong with this script, but I'm not seeing it.
Any help is greatly appreciated.
I'm going to try restarting my pc. I'm so lost!
here's the script
Code: Select all
<?php
require_once ('./includes/mysql_connect.php');
require_once ('./includes/functions.php') ;
include ('./includes/header_footer/header.inc.htm');
$page_title = 'deleting the student';
echo '<p>the script is running</p>';
if $_SESSION['sid'] == $_GET['sid'] { //----IF THIS PAGE WAS REACHED INTENTIONALLY------------------- 1
$s_nfo_query =
"SELECT
sid,
first_name,
last_name,
sex,
reg_date,
dob,
school,
active,
medical_issues,
secret_classification,
last_update,
pid
FROM
student_info
LEFT JOIN
student_parent
USING
(sid)
LEFT JOIN
parent_info
USING
(pid)
WHERE
(student_info.sid = '".$_GET['sid']."' ) " ;
$result = mysql_query($s_nfo_query) or die(mysql_error()."[sql:$s_nfo_query]");
$s_nfo = mysql_fetch_assoc($result);
//-------------------CHECK TO SEE IF THIS PARENT HAS ANOTHER STUDENT ASSOCIATED WITH IT-------------
$p_nfo_query ="
SELECT
sid,
first_name,
last_name
FROM
student_info
LEFT JOIN
student_parent
USING
(sid)
WHERE
( pid = '".$s_nfo['pid']."')
AND
( student_info_sid != '".$result['sid']." ) ";
$result1 = mysql_query($p_nfo_query) or die(mysql_error()."[sql:$p_nfo_query]");
if ($result1>1) {
$delete_s_p = "
DELETE
student_info ,
student_parent
FROM
student_info ,
student_parent
WHERE
student_info.sid = student_parent.sid
AND
student_info.sid = ".$result['sid']." ";
$deleted_s_p =mysql_query(delete_s_p) or die(mysql_error()."[sql:$delete_s_p]");
IF ($deleted_s_p) {
$delete_c_s1 = "
DELETE
classes_students
WHERE
sid = ".$result1['sid']." ";
$deleted_c_s1 =mysql_query(delete_c_s1) or die(mysql_error()."[sql:$delete_c_s1]");
echo" <div align =\"center\">the student ".$result['first_name'] ." ". $result['first_name']." Has been deleted
from your records. \n
This student's parent will remain in your records because there is atleast one other student \n
in your records that is registered with this parent. If you would like to delete this parent's record \n
from your records then you must delete the associated student. When you delete the last student \n
associated with this parent the parent's record will automatically be deleted.
If an error was made when entering a student or parents information and you find yourself \n
in a situation where you need to associate the parent to a different student then you may retrieve \n
all of the neccesary information from your email to re-enter it as it was stored in your records. \n
Any record, student or parent, is emailed to you upon being deleted from your records. \n\n\n\n
The following student(s) are registered with this same student's parent" ;
while ($result1 = mysql_fetch_array($result1, MYSQL_ASSOC) {
echo" ".$result1['sid']." </div>" ; }
}
} else { //----------------IF THIS IS RECORD HAS NO SIBLINGS IN DB------
$delete_s_p2 = "
DELETE
student_info ,
student_parent ,
parent_info
FROM
student_info ,
student_parent ,
parent_info
WHERE
student_info.sid = student_parent.sid
AND
student_parent.pid=parent_info.pid
AND
student_info.sid = ".$result['sid']." ";
$deleted_s_p2 =mysql_query(delete_s_p2) or die(mysql_error()."[sql:$delete_s_p2]");
IF ($deleted_s_p2) {
$delete_c_s2 = "
DELETE
classes_students
WHERE
sid = ".$result1['sid']." ";
$deleted_c_s2 =mysql_query(delete_c_s2) or die(mysql_error()."[sql:$delete_c_s2]");
if ($deleted_c_s2) {
echo " the student ".$result['first_name'] ." ". $result['first_name']." Has been deleted
from your records along with any associated data and records.\n" ;
}
}
} //-----------------END ELSE STATEMENT-----------
} //-----------END OF IF PAGE WAS REAHED INTENTIONALLY---------- 1
else {
// Redirect the user to the next page.
// Start defining the URL.
$url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
// Check for a trailing slash.
if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) {
$url = substr ($url, 0, -1); // Chop off the slash.
}
// Add the page.
$url .= '/index.php';
header("Location: $url");
exit(); } //------------END REDIRECT
include ('./includes/header_footer/footer.inc.htm');
?>