PHP and mySQL

Hey, I’m having a bit of trouble with this code…

[code]<?php
#view_appointment.php
session_start();

if($_SESSION[‘access_level’] == 1)
{
#require_once(’./connections/connect.php’);
#require_once(’./templates/header.php’);
$query = “SELECT * FROM appointment”;
$result = mysql_query($query);

echo ‘

View Appointments

’;
echo “”;
echo “”;
echo “”;

while ($row = mysql_fetch_array($result))
{
$aid = $row[‘a_id’];
$adate = $row[‘a_date’];
$pid = $row[‘p_id’];
$diagnosis = $row[‘diagnosis’];
$fee = $row[‘fee’]
$_SESSION[‘a_id’] = $a_id;

echo "<tr><td>$a_id</td><td>$a_date</td><td>$p_id</td><td>$diagnosis</td><td>$fee</td>";

echo '<td><form method="post" action="delete_appointment.php" name"delete_appointment"><input type = "submit" name = "submit" id = "submit" value = "Delete Appointment"/><input type = "hidden" name = "a_id" value = "'.$aid. '"/></form></td><td><form method = "post" action = "edit_appointment.php" name = "edit_appointment"><input type = "submit" name = "submit" id = "submit" value = "Edit Appointment" /><input type = "hidden" name = "id" value = "'.$aid'" /></form></td></tr>';

}

echo “

Appointment ID Appointment Date Patient ID Diagnosis Fee
”;
}
?>

Select an option to refine your search

View Appointment By:

Appointment ID Appointment Date Diagnosis Fee

Enter Appointment ID :

<input type = "submit" name = "search" id = "search" value = "Go" <?php if (isset($_POST['submit'])) { $view = $_POST['view']; switch($view) { case 'a_id': $query = "SELECT a_id, a_date, diagnosis, fee, p_id FROM appointment ORDER BY a_id"; $result = mysql_query($query) or die(mysql_error()); $num_results = mysql_num_rows($result); echo '

Number of records found: '.$num_results.'

'; echo ''; echo ''; while ($row = mysql_fetch_array($result)) { echo ''; echo ''; echo ''; echo '; echo '; echo '; echo ''; } echo '
Appointment ID Appointment Date Patient ID Diagnosis Fee

'.$row['a_id'].'

'.$row['a_date'].'

'.$row['p_id'].'

'.$row['diagnosis'].'

'.$row['fee'].'

'; break; case 'a_date': $query = "SELECT a_id, a_date, diagnosis, fee, p_id FROM appointment ORDER BY a_date"; $result = mysql_query($query) or die(mysql_error()); $num_results = mysql_num_rows($result); echo '

Number of records found: '.$num_results.'

'; echo ''; echo ''; while ($row = mysql_fetch_array($result)) { echo ''; echo ''; echo ''; echo '; echo '; echo '; echo ''; } echo '
Appointment ID Appointment Date Patient ID Diagnosis Fee

'.$row['a_id'].'

'.$row['a_date'].'

'.$row['p_id'].'

'.$row['diagnosis'].'

'.$row['fee'].'

'; break; case 'p_id': $query = "SELECT a_id, a_date, diagnosis, fee, p_id FROM appointment ORDER BY p_id"; $result = mysql_query($query) or die(mysql_error()); $num_results = mysql_num_rows($result); echo '

Number of records found: '.$num_results.'

'; echo ''; echo ''; while ($row = mysql_fetch_array($result)) { echo ''; echo ''; echo ''; echo '; echo '; echo '; echo ''; } echo '
Appointment ID Appointment Date Patient ID Diagnosis Fee

'.$row['a_id'].'

'.$row['a_date'].'

'.$row['p_id'].'

'.$row['diagnosis'].'

'.$row['fee'].'

'; break; case 'diagnosis': $query = "SELECT a_id, a_date, diagnosis, fee, p_id FROM appointment ORDER BY diagnosis"; $result = mysql_query($query) or die(mysql_error()); $num_results = mysql_num_rows($result); echo '

Number of records found: '.$num_results.'

'; echo ''; echo ''; while ($row = mysql_fetch_array($result)) { echo ''; echo ''; echo ''; echo '; echo '; echo '; echo ''; } echo '
Appointment ID Appointment Date Patient ID Diagnosis Fee

'.$row['a_id'].'

'.$row['a_date'].'

'.$row['p_id'].'

'.$row['diagnosis'].'

'.$row['fee'].'

'; break; case 'fee': $query = "SELECT a_id, a_date, diagnosis, fee, p_id FROM appointment ORDER BY fee"; $result = mysql_query($query) or die(mysql_error()); $num_results = mysql_num_rows($result); echo '

Number of records found: '.$num_results.'

'; echo ''; echo ''; while ($row = mysql_fetch_array($result)) { echo ''; echo ''; echo ''; echo '; echo '; echo '; echo ''; } echo '
Appointment ID Appointment Date Patient ID Diagnosis Fee

'.$row['a_id'].'

'.$row['a_date'].'

'.$row['p_id'].'

'.$row['diagnosis'].'

'.$row['fee'].'

'; break; } } if (isset($_POST['search'])) { $find = $_POST['find']; $query = "SELECT * FROM appointment WHERE a_id = '$find'"; $result = mysql_query($query) or die(mysql_error()); $num_results = mysql_num_rows($result); echo '

Number of records found: '.$num_results.'

'; echo ''; echo ''; while ($row = mysql_fetch_array($result)) { echo ''; echo ''; echo ''; echo '; echo '; echo '; echo ''; } echo '
Appointment ID Appointment Date Patient ID Diagnosis Fee

'.$row['a_id'].'

'.$row['a_date'].'

'.$row['p_id'].'

'.$row['diagnosis'].'

'.$row['fee'].'

'; } #require_once ('./templates/footer.php'); ?>

[/code]

When I try to run it, I receive the following error:

Parse error: parse error, unexpected T_VARIABLE in c:webstestview_appointment.php on line 24

Thanks, Any help appreciated!!! :D

Which line is line 24?

Sponsor our Newsletter | Privacy Policy | Terms of Service