I am deleting one record off the data base. The page before this is the list of all the records and the date of which they where submited. By clicking on one this page comes up with all the info and a delete button out beside it.
What am i doing wrong i have tried many variations and still nothing..
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_displayStatusMsg(msgStr) { //v1.0
status=msgStr;
document.MM_returnValue = true;
}
//-->
</script>
<?php //view_tryinfo.php
if (ini_get('register_globals') < 1) {
$PHP_SELF = $_SERVER['PHP_SELF'];
if (isset($GET['name'])) {
require_once('...mysql_connect.php');
$query = $query = "SELECT * FROM tryout WHERE name='".$GET['name']."'";
$result = mysql_query ($query);
if(!$result) { echo("MySQL Error: ".mysql_error()); }
$row = mysql_fetch_array($result);
mysql_close();
}
$page_title = $row['name'];
include('...header.htm');
echo ' <table width="95%" border="0" cellspacing="3" cellpadding="0">
<tr>
<th width="22%" scope="row"><div align="left" class="style2"><b>Name</b></div></th>
<th width="30%" scope="row"><div align="left" class="style2"><b>Email</b></div></th>
<td width="20%"><div align="left" class="style2"><b>Location</b></div></td>
<td width="5%"><div align="left" class="style2"><b>Age</b></div></td>
<td width="4%"><div align="left" class="style2"><b>Sex</b></div></td>
<td width="11%"><div align="left" class="style2"><b>Date</b></div></td>
<td width="8%"><div align="left" class="style2"><b>Delete</b></div></td>
</tr>
';
echo ' <td align="left"><span class="style2">'.$row['name'].'</span></td>
<td align="left" ><span class="style2">'.$row['email'].'</span></td>
<td align="left" ><span class="style2">'.$row['loc'].'</span></td>
<td align="left" ><span class="style2">'.$row['age'].'</span></td>
<td align="left" ><span class="style2">'.$row['mf'].'</span></td>
<td align="left" ><span class="style2">'.$row['date'].'</span></td>
<td align="left" ><span class="style2">';
?>
<input name="Delete" type="button" id="Delete" onClick="<?php
require_once('...mysql_connect.php');
$query2 = $query2 = "DELETE FROM tryout Where name='".$row['name']."' AND email='".$row['email']."' Limit 1";
$result2 = mysql_query ($query2);
if(!$result2) { echo("MySQL Error: ".mysql_error()); }
mysql_close();
?>, MM_displayStatusMsg('Deleting Record of Tryouter!');return document.MM_returnValue"
value="Delete">
<?php
echo '</a></span></td>
</table>';
} else {
header("Location:http://" .$SERVER['HTTP_HOST'] . dirname($SERVER['PHP_SELF']) ."/index.php");
exit();
}
?>
🙁
everything works except for the deleting part.... 😕 😕