where am i going wrong

Does anyone have any idea where i am going wrong here? I have a quiz on a html page and i want the answers to be submitted into a table. My html page is fine but i am going wrong somewhere in my php page as shown below. Please can someone help?

[php]<?php
$id = $_GET[‘patid’];
$name = $_GET[‘name’];
$app = $_GET[‘appointment’];
$ward = $_GET[‘ward’];
if (isset($_GET[‘xray’])) {
$xray = $_GET[‘xray’];
} else {
$xray = “No”;
}
print “Name:”.$name."
";
print “Appointment:”.$app."
";
print “Ward:”.$ward."
";
print “X-Ray:”.$xray."
";
print “MRI:”.$mri."
";
print “CSCAN:”.$cscan."
";
print “EYE:”.$eye."
";
print “HEARING:”.$hearing."
";
$link = mysql_connect(‘localhost’,‘student’,‘student’) or die(mysql_error());
mysql_select_db(‘hospital’,$link);
$querydate = “SELECT CURDATE() as Today”;
$result1 = mysql_query($querydate,$link) or die(mysql_error());
$row = mysql_fetch_assoc($result1);
$today = $row[‘Today’];
$query = “INSERT INTO discharge VALUES (NULL,’$name’,’$app’,’$ward’,’$xray’,’$mri’,’$cscan’,’$eye’,’$hearing’,’$today’)”;
$result = mysql_query($query,$link) or die(mysql_error());
$affected = mysql_affected_rows($link);

if ($affected >0) {echo “success”;} else {echo “fail”;}
$query3 = “SELECT * FROM discharge”;
$result3 = mysql_query($query3,$link) or die(mysql_error());
$row3 = mysql_fetch_assoc($result3);
?>

<table width="200" border="1"; Patient ID Patient Name Appointment Type Admitted to Ward X-Ray MRI Cat Scan Eye Test Hearing Test Date Discharged <?php echo $row3['patid']; ?> <?php echo $row3['name']; ?> <?php echo $row3['appointment']; ?> <?php echo $row3['ward']; ?> <?php echo $row3['xray']; ?> <?php echo $row3['mri']; ?> <?php echo $row3['cscan']; ?> <?php echo $row3['eye']; ?> <?php echo $row3['hearing']; ?> <?php echo $row3['date']; ?> <?php do { ?> <?php echo $row3['patid']; ?> <?php echo $row3['name']; ?> <?php echo $row3['appointment']; ?> <?php echo $row3['ward']; ?> <?php echo $row3['xray']; ?> <?php echo $row3['mri']; ?> <?php echo $row3['cscan']; ?> <?php echo $row3['eye']; ?> <?php echo $row3['hearing']; ?> <?php echo $row3['date']; ?> <?php } while ($row3=mysql_fetch_assoc($result3)); ?> <?php mysql_close($link); ?> [/php]

A quiz? That looks like your attempting to list medical record listings from a database table?

If you found the script from the internet, throw it in the trash for it’s using obsolete mysql, it should be using mysqli or PDO (My Recommendation).

If you got that script from your place of employment, I would be careful not to let that go live on a production server, for I don’t think people would take to kindly having their medical records broadcasted on the internet.

I normally wouldn’t mind helping out, but I don’t want to get involved with something that might compromise people’s private medical records.

Sponsor our Newsletter | Privacy Policy | Terms of Service