Jump to content

Recommended Posts

I can't figure out how to get an edit or delete function into this. If you need to access the staff area of the site to check out how I have it layed out or anything please drop me a PM and I will set you up with a login and password and the sites URL. Thanks so much to anyone who can help me here.

 

<html>
<head>
<title>ParasiteDB - Research and Remove Parasites!</title>
<META content="parasite, virus, malware, removal, computer, pc, database, pdb, db" name=keywords>
<META content="You can research and find ways to remove hundreds of different parasites here. Come take a look!" name=description>
<style TYPE="text/css">
A{text-decoration:none}
A:hover{color:#FFFFFF;text-decoration:underline}
}
BODY {
SCROLLBAR-FACE-COLOR: #000000; SCROLLBAR-HIGHLIGHT-COLOR: #000000; SCROLLBAR-SHADOW-COLOR: #0099CC; SCROLLBAR-3DLIGHT-COLOR: #0099CC; SCROLLBAR-ARROW-COLOR: #0099CC; SCROLLBAR-TRACK-COLOR: #000000; SCROLLBAR-DARKSHADOW-COLOR: #0000000;
}
</style>
</head>

<BODY BGCOLOR="#000000" TEXT="#FFFFFF" VLINK="#0099CC" ALINK="#0099CC" LINK="#0099CC" topmargin="0">

<table border="0" cellspacing="1" width="100%">
  <tr>
    <td width="100%" background="logo.jpg">
      <table border="0" cellpadding="0" cellspacing="0" width="100%" bordercolor="#FFFFFF">
        <tr>
          <td width="100%" background="images/logo.jpg" height="80">
            <p align="center"><font color="#FFFFFF" size="4" face="Arial"><b>ParasiteDB - Research and Remove Parasites!</b></font></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="100%">
      <table border="1" cellpadding="5" cellspacing="5" width="100%" bordercolor="#FFFFFF">
        <tr>
          <td width="20%" valign="top">
        <font face="Arial" size="2"><b> Navigation</b></font><br>

            <font face="Arial" size="2">
           - <a href="http://parasitedb.freehostia.com/index.php">Home</a><br>
           - <a href="mailto:Webmaster@parasitedb.freehostia.com?subject=Contact Us">Contact Us</a><br>
				  - <a href="mailto:Webmaster@parasitedb.freehostia.com?subject=Advertise">Advertise</a><br>
           - <a href="http://parasitedb.freehostia.com/search.php">Search</a><br>
           - <a href="index.php">Staff Login</a><br>
           - <a href="view_online.php">View Users Online</a></font>

          <font face="Arial" size="1">
          <p>

          </font><font face="Arial" size="2">
				<font face="Arial" size="2">Google Ads Coming Soon!</font></a><font face="Arial" size="1">
          <p>

          <font face="Arial" size="2"><b> Sponsors</b></font><br>


				 </font><font face="Arial" size="2">- <a href="http://malwareremoval.com/">Malware Removal</a><br>
           - <a href="http://pchelpforum.com/">PC Help Forum</a><br>
            </font></td>
          <td width="80%" valign="top"><b><font face="Arial"><font size="2" color="#FFFFFF"><center><br>

<?php if (isset($_GET['addparasite'])): // User wants to add a joke
?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<label>Name:<br />
<textarea name="parasitename" rows="1" cols="50">
</textarea></label><br />
<label>From:<br />
<textarea name="parasitefrom" rows="1" cols="50">
</textarea></label><br />
<label>Genre:<br />
<textarea name="parasitegenre" rows="1" cols="50">
</textarea></label><br /
<label>Description:<br />
<textarea name="parasitedescription" rows="5" cols="50">
</textarea></label><br />
<label>Removal Info:<br />
<textarea name="parasiteremoval" rows="5" cols="50">
</textarea></label><br />
<input type="submit" value="Add" />
</form>

<?php else: // Default page display

$dbcnx = @mysql_connect('xxxxx', 'adaarm_db', 'xxxxx');
if (!$dbcnx) {
   exit('<p>Unable to connect to the ' .
       'database server at this time.</p>');
}

if (!@mysql_select_db('adaarm_db')) {
   exit('<p>Unable to locate the ' .
       'database at this time.</p>');
}

if (isset($_POST['parasitename'])) {
   $parasitename = $_POST['parasitename'];
   $parasitefrom = $_POST['parasitefrom'];
   $parasitegenre = $_POST['parasitegenre'];
   $parasitedescription = $_POST['parasitedescription'];
   $parasitetechremoval = $_POST['parasiteremoval'];
   $sql = "INSERT INTO parasite SET
       parasitename='$parasitename',
       parasitefrom='$parasitefrom',
       parasitegenre='$parasitegenre',
       parasitedescription='$parasitedescription',
       parasiteremoval='$parasiteremoval'";
   if (@mysql_query($sql)) {
     echo "<p>The parasite '$parasitename' has been added.</p>";
   } else {
     echo '<p>Error adding submitted parasite: ' .
         mysql_error() . '</p>';
   }
}

echo '<p><a href="' . $_SERVER['PHP_SELF'] .
     '?addparasite=1">Add a Parasite</a></p>';

$sql = mysql_query("SELECT parasitename,parasitefrom,parasitegenre,parasitedescription,id FROM parasite ORDER BY parasitename ASC") or die(mysql_error());

echo "Parasites in Database:<br><br>";
echo "<table width=90% align=center border=1><tr>
<td align=center>Name</td>
<td align=center>From</td>
<td align=center>Genre</td>
</tr>";

while ($r = mysql_fetch_array($sql)) { // Begin while
$id = $r["id"];
$name = $r["parasitename"];
$from = $r["parasitefrom"];
$genre = $r["parasitegenre"];
echo "<tr>
<td><a href=view.php?id=$id>$name</a></td>
<td>$from</td>
<td>$genre</td></tr>";
} // end while
echo "</table>";

endif;
?> </table>

</center>
            </div>
            <p> </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="100%">
      <p align="center"><font size="2"><font face="Arial">All Site Content &copy 2007 - ParasiteDB<br>All Rights Reserved</font></td>
  </tr>
</table>
</BODY>
</html>

Link to comment
https://forums.phpfreaks.com/topic/62711-solved-edit-and-delete-function/
Share on other sites

I want a delete and edit button added to each line so that the staff member can delete the parasite from the database. This index.php is in the /staff dir and is protected with .htaccess for the staff only. The main site has the search function and all.

 

Thanks,

Adam

I'm not familiar with .htaccess. I googled it but I'm not sure how to parse a php security script so that will be up to you. not tested....

 

<?php // <---- Don't forget remove this php tag.
if (isset($_GET['delete')) {
    $delete_id = $_GET['delete'];
    $delete_name = $_GET['name'];
    unset($_GET['name']);
    unset($_GET['delete']);
    $delete_sql = "DELETE * FROM parasite WHERE id='$delete_id'";
    $result = mysql_query($delete_sql)or die(mysql_error());

        if ($result) {
            echo "The parasite named $delete_name had been deleted.";
        }else{
            echo "The delete could not be carried out.";
        }
}

if (isset($_POST['parasitename'])) {
   $parasitename = $_POST['parasitename'];
   $parasitefrom = $_POST['parasitefrom'];
   $parasitegenre = $_POST['parasitegenre'];
   $parasitedescription = $_POST['parasitedescription'];
   $parasitetechremoval = $_POST['parasiteremoval'];
   $sql = "INSERT INTO parasite SET
       parasitename='$parasitename',
       parasitefrom='$parasitefrom',
       parasitegenre='$parasitegenre',
       parasitedescription='$parasitedescription',
       parasiteremoval='$parasiteremoval'";
   if (@mysql_query($sql)) {
     echo "<p>The parasite '$parasitename' has been added.</p>";
   } else {
     echo '<p>Error adding submitted parasite: ' .
         mysql_error() . '</p>';
   }
}

echo '<p><a href="' . $_SERVER['PHP_SELF'] .
     '?addparasite=1">Add a Parasite</a></p>';


$sql = mysql_query("SELECT parasitename,parasitefrom,parasitegenre,parasitedescription,id FROM parasite ORDER BY parasitename ASC") or die(mysql_error());

echo "Parasites in Database:<br><br>";
echo "<table width=90% align=center border=1><tr>
<td align=center>Name</td>
<td align=center>From</td>
<td align=center>Genre</td>
</tr>";

while ($r = mysql_fetch_array($sql)) { // Begin while
$id = $r["id"];
$name = $r["parasitename"];
$from = $r["parasitefrom"];
$genre = $r["parasitegenre"];

/* create a $_GET variable called delete using the objects id. Edit the this page link to the name of this page.*/

echo "<tr>
<td><a href=view.php?id=$id>$name</a></td>
<td>$from</td>
<td>$genre</td>
<td><a href='thispage.php?delete=$id&name=$name'>Delete</a></td></tr>";
} // end while
echo "</table>";

endif;
?> 

Here's the edit, not tested and there's a solid chance of errors.

 

 

<?php // <---- Don't forget remove this php tag.
if (isset($_GET['edit')) {
    
    $edit_id = $_GET['edit'];
    unset($_GET['edit']);

    $query = "SELECT * FROM parasite WHERE id='$edit_id'";
    $result = mysql_query($query)or die(mysql_error());
    $data = mysql_fetch_assoc($result);
?>


   <fieldset><legend>Parasite Edit</legend>
   <form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
    <input type="hidden" name="id" value="<?php echo $data['id']; ?>">
   Parasitename:<input type="text" name="parasitename" value="<?php echo $data['parasitename']; ?>"><br />
    Parasitefrom:<input type="text" name"parasitefrom" value="<?php echo $data['parasitefrom']; ?>"><br />
    Parasitegenre:<input type="text" name="parasitegenre" value="<?php echo $data['parasitegenre']; ?>"><br />
    Parasitedescription:<input type="text" name="parasitedescription" value="<?php echo $data['parasitedescription']; ?>"><br />
    Parasiteremoval:<input type="text" name="parasiteremoval" value="<?php echo $data['parasiteremoval']; ?>"><br />
<input type="submit" value="Submit" name="parasiteedit">
</form>
</fieldset>

<?php
}

    if (isset($_REQUEST['parasiteedit'])) {
        $n = $_REQUEST['parasitename'];
        $f = $_REQUEST['parasitefrom'];
        $g = $_REQUEST['parasitegenre'];
        $d = $_REQUEST['parasitedescription'];
        $r = $_REQUEST['parasiteremoval'];
        $id= $_REQUEST['id'];      

    $edit_sql = "UPDATE parasite SET
     parasitename='$n',
     parasitefrom='$f',
     parasitegenre='$g',
     parasitedescription='$d',
     parasiteremoval='$r' 
     WHERE id='$id'";

    $result = mysql_query($edit_sql)or die(mysql_error());

        if ($result) {
            echo "The parasite named $edit_name has been changed.<br />
                     New values: <br />
                     Parasitename: $parasitename <br />
                     Parasitefrom: $parasitefrom <br />
                     Parasitegenre: $parasitegenre <br />
                     Parasitedescription: $parasitedescription <br />
                     Parasiteremoval: $parasiteremoval";
        }else{
            echo "The edit request could not be carried out.";
        }
}

<?php // <---- Don't forget remove this php tag.
if (isset($_GET['delete')) {
    $delete_id = $_GET['delete'];
    $delete_name = $_GET['name'];
    unset($_GET['name']);
    unset($_GET['delete']);
    $delete_sql = "DELETE * FROM parasite WHERE id='$delete_id'";
    $result = mysql_query($delete_sql)or die(mysql_error());

        if ($result) {
            echo "The parasite named $delete_name had been deleted.";
        }else{
            echo "The delete could not be carried out.";
        }
}

if (isset($_POST['parasitename'])) {
   $parasitename = $_POST['parasitename'];
   $parasitefrom = $_POST['parasitefrom'];
   $parasitegenre = $_POST['parasitegenre'];
   $parasitedescription = $_POST['parasitedescription'];
   $parasitetechremoval = $_POST['parasiteremoval'];
   $sql = "INSERT INTO parasite SET
       parasitename='$parasitename',
       parasitefrom='$parasitefrom',
       parasitegenre='$parasitegenre',
       parasitedescription='$parasitedescription',
       parasiteremoval='$parasiteremoval'";
   if (@mysql_query($sql)) {
     echo "<p>The parasite '$parasitename' has been added.</p>";
   } else {
     echo '<p>Error adding submitted parasite: ' .
         mysql_error() . '</p>';
   }
}

echo '<p><a href="' . $_SERVER['PHP_SELF'] .
     '?addparasite=1">Add a Parasite</a></p>';


$sql = mysql_query("SELECT parasitename,parasitefrom,parasitegenre,parasitedescription,parasiteremoval,id FROM parasite ORDER BY parasitename ASC") or die(mysql_error());

echo "Parasites in Database:<br><br>";
echo "<table width=90% align=center border=1><tr>
<td align=center>Name</td>
<td align=center>From</td>
<td align=center>Genre</td>
</tr>";

while ($r = mysql_fetch_array($sql)) { // Begin while
$id = $r["id"];
$name = $r["parasitename"];
$from = $r["parasitefrom"];
$genre = $r["parasitegenre"];
$description = $r["parasitegenre"];
$removal = $r["parasiteremoval"];

/* create a $_GET variable called delete using the objects id. Edit the this page link to the name of this page.*/

echo "<tr>
<td><a href=view.php?id=$id>$name</a></td>
<td>$from</td>
<td>$genre</td>
<td><a href='thispage.php?delete=$id&name=$name'>Delete</a></td>
<td><a href='thispage.php?edit=$id>Edit</a></tr>";
} // end while
echo "</table>";

endif;
?> 

Try this.... If you get errors post them.

 

<html>
<head>
<title>ParasiteDB - Research and Remove Parasites!</title>
<META content="parasite, virus, malware, removal, computer, pc, database, pdb, db" name=keywords>
<META content="You can research and find ways to remove hundreds of different parasites here. Come take a look!" name=description>
<style TYPE="text/css">
A{text-decoration:none}
A:hover{color:#FFFFFF;text-decoration:underline}
}
BODY {
SCROLLBAR-FACE-COLOR: #000000; SCROLLBAR-HIGHLIGHT-COLOR: #000000; SCROLLBAR-SHADOW-COLOR: #0099CC; SCROLLBAR-3DLIGHT-COLOR: #0099CC; SCROLLBAR-ARROW-COLOR: #0099CC; SCROLLBAR-TRACK-COLOR: #000000; SCROLLBAR-DARKSHADOW-COLOR: #0000000;
}
</style>
</head>

<BODY BGCOLOR="#000000" TEXT="#FFFFFF" VLINK="#0099CC" ALINK="#0099CC" LINK="#0099CC" topmargin="0">

<table border="0" cellspacing="1" width="100%">
  <tr>
    <td width="100%" background="logo.jpg">
      <table border="0" cellpadding="0" cellspacing="0" width="100%" bordercolor="#FFFFFF">
        <tr>
          <td width="100%" background="images/logo.jpg" height="80">
            <p align="center"><font color="#FFFFFF" size="4" face="Arial"><b>ParasiteDB - Research and Remove Parasites!</b></font></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="100%">
      <table border="1" cellpadding="5" cellspacing="5" width="100%" bordercolor="#FFFFFF">
        <tr>
          <td width="20%" valign="top">
        <font face="Arial" size="2"><b> Navigation</b></font><br>

            <font face="Arial" size="2">
           - <a href="http://parasitedb.freehostia.com/index.php">Home</a><br>
           - <a href="mailto:Webmaster@parasitedb.freehostia.com?subject=Contact Us">Contact Us</a><br>
				 - <a href="mailto:Webmaster@parasitedb.freehostia.com?subject=Advertise">Advertise</a><br>
           - <a href="http://parasitedb.freehostia.com/search.php">Search</a><br>
           - <a href="index.php">Staff Login</a><br>
           - <a href="view_online.php">View Users Online</a></font>

          <font face="Arial" size="1">
          <p>

          </font><font face="Arial" size="2">
				<font face="Arial" size="2">Google Ads Coming Soon!</font></a><font face="Arial" size="1">
          <p>

          <font face="Arial" size="2"><b> Sponsors</b></font><br>


				 </font><font face="Arial" size="2">- <a href="http://malwareremoval.com/">Malware Removal</a><br>
           - <a href="http://pchelpforum.com/">PC Help Forum</a><br>
            </font></td>
          <td width="80%" valign="top"><b><font face="Arial"><font size="2" color="#FFFFFF"><center><br>

<?php if (isset($_GET['addparasite'])): // User wants to add a joke
?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<label>Name:<br />
<textarea name="parasitename" rows="1" cols="50">
</textarea></label><br />
<label>From:<br />
<textarea name="parasitefrom" rows="1" cols="50">
</textarea></label><br />
<label>Genre:<br />
<textarea name="parasitegenre" rows="1" cols="50">
</textarea></label><br /
<label>Description:<br />
<textarea name="parasitedescription" rows="5" cols="50">
</textarea></label><br />
<label>Removal Info:<br />
<textarea name="parasiteremoval" rows="5" cols="50">
</textarea></label><br />
<input type="submit" value="Add" />
</form>

<?php else: // Default page display

$dbcnx = @mysql_connect('xxxxx', 'adaarm_db', 'xxxxx');
if (!$dbcnx) {
   exit('<p>Unable to connect to the ' .
       'database server at this time.</p>');
}

if (!@mysql_select_db('adaarm_db')) {
   exit('<p>Unable to locate the ' .
       'database at this time.</p>');
}

if (isset($_GET['edit')) {
    
    $edit_id = $_GET['edit'];
    unset($_GET['edit']);

    $query = "SELECT * FROM parasite WHERE id='$edit_id'";
    $result = mysql_query($query)or die(mysql_error());
    $data = mysql_fetch_assoc($result);
?>


   <fieldset><legend>Parasite Edit</legend>
   <form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
    <input type="hidden" name="id" value="<?php echo $data['id']; ?>">
   Parasitename:<input type="text" name="parasitename" value="<?php echo $data['parasitename']; ?>"><br />
    Parasitefrom:<input type="text" name"parasitefrom" value="<?php echo $data['parasitefrom']; ?>"><br />
    Parasitegenre:<input type="text" name="parasitegenre" value="<?php echo $data['parasitegenre']; ?>"><br />
    Parasitedescription:<input type="text" name="parasitedescription" value="<?php echo $data['parasitedescription']; ?>"><br />
    Parasiteremoval:<input type="text" name="parasiteremoval" value="<?php echo $data['parasiteremoval']; ?>"><br />
<input type="submit" value="Submit" name="parasiteedit">
</form>
</fieldset>

<?php
}

    if (isset($_REQUEST['parasiteedit'])) {
        $n = $_REQUEST['parasitename'];
        $f = $_REQUEST['parasitefrom'];
        $g = $_REQUEST['parasitegenre'];
        $d = $_REQUEST['parasitedescription'];
        $r = $_REQUEST['parasiteremoval'];
        $id= $_REQUEST['id'];      

    $edit_sql = "UPDATE parasite SET
     parasitename='$n',
     parasitefrom='$f',
     parasitegenre='$g',
     parasitedescription='$d',
     parasiteremoval='$r' 
     WHERE id='$id'";

    $result = mysql_query($edit_sql)or die(mysql_error());

        if ($result) {
            echo "The parasite named $edit_name has been changed.<br />
                     New values: <br />
                     Parasitename: $parasitename <br />
                     Parasitefrom: $parasitefrom <br />
                     Parasitegenre: $parasitegenre <br />
                     Parasitedescription: $parasitedescription <br />
                     Parasiteremoval: $parasiteremoval";
        }else{
            echo "The edit request could not be carried out.";
        }
}

if (isset($_GET['delete')) {
    $delete_id = $_GET['delete'];
    $delete_name = $_GET['name'];
    unset($_GET['name']);
    unset($_GET['delete']);
    $delete_sql = "DELETE * FROM parasite WHERE id='$delete_id'";
    $result = mysql_query($delete_sql)or die(mysql_error());

        if ($result) {
            echo "The parasite named $delete_name had been deleted.";
        }else{
            echo "The delete could not be carried out.";
        }
}

if (isset($_POST['parasitename'])) {
   $parasitename = $_POST['parasitename'];
   $parasitefrom = $_POST['parasitefrom'];
   $parasitegenre = $_POST['parasitegenre'];
   $parasitedescription = $_POST['parasitedescription'];
   $parasitetechremoval = $_POST['parasiteremoval'];
   $sql = "INSERT INTO parasite SET
       parasitename='$parasitename',
       parasitefrom='$parasitefrom',
       parasitegenre='$parasitegenre',
       parasitedescription='$parasitedescription',
       parasiteremoval='$parasiteremoval'";
   if (@mysql_query($sql)) {
     echo "<p>The parasite '$parasitename' has been added.</p>";
   } else {
     echo '<p>Error adding submitted parasite: ' .
         mysql_error() . '</p>';
   }
}

echo '<p><a href="' . $_SERVER['PHP_SELF'] .
     '?addparasite=1">Add a Parasite</a></p>';


$sql = mysql_query("SELECT parasitename,parasitefrom,parasitegenre,parasitedescription,parasiteremoval,id FROM parasite ORDER BY parasitename ASC") or die(mysql_error());

echo "Parasites in Database:<br><br>";
echo "<table width=90% align=center border=1><tr>
<td align=center>Name</td>
<td align=center>From</td>
<td align=center>Genre</td>
</tr>";

while ($r = mysql_fetch_array($sql)) { // Begin while
$id = $r["id"];
$name = $r["parasitename"];
$from = $r["parasitefrom"];
$genre = $r["parasitegenre"];
$description = $r["parasitegenre"];
$removal = $r["parasiteremoval"];

/* create a $_GET variable called delete using the objects id. Edit the this page link to the name of this page.*/

echo "<tr>
<td><a href=view.php?id=$id>$name</a></td>
<td>$from</td>
<td>$genre</td>
<td><a href='thispage.php?delete=$id&name=$name'>Delete</a></td>
<td><a href='thispage.php?edit=$id>Edit</a></tr>";
} // end while
echo "</table>";

endif;
?> 

</table>

</center>
            </div>
            <p> </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="100%">
      <p align="center"><font size="2"><font face="Arial">All Site Content &copy 2007 - ParasiteDB<br>All Rights Reserved</font></td>
  </tr>
</table>
</BODY>
</html>

 

 

Ok, I got that error fixed.. should have checked it before posting.  :-[

 

New error that I can't figure out:

 

Parse error: parse error, unexpected '{' in /home/www/parasitedb.freehostia.com/staff/index.php on line 94

 

Line with error is

if (isset($_GET['edit]) {

 

<html>
<head>
<title>ParasiteDB - Research and Remove Parasites!</title>
<META content="parasite, virus, malware, removal, computer, pc, database, pdb, db" name=keywords>
<META content="You can research and find ways to remove hundreds of different parasites here. Come take a look!" name=description>
<style TYPE="text/css">
A{text-decoration:none}
A:hover{color:#FFFFFF;text-decoration:underline}
}
BODY {
SCROLLBAR-FACE-COLOR: #000000; SCROLLBAR-HIGHLIGHT-COLOR: #000000; SCROLLBAR-SHADOW-COLOR: #0099CC; SCROLLBAR-3DLIGHT-COLOR: #0099CC; SCROLLBAR-ARROW-COLOR: #0099CC; SCROLLBAR-TRACK-COLOR: #000000; SCROLLBAR-DARKSHADOW-COLOR: #0000000;
}
</style>
</head>

<BODY BGCOLOR="#000000" TEXT="#FFFFFF" VLINK="#0099CC" ALINK="#0099CC" LINK="#0099CC" topmargin="0">

<table border="0" cellspacing="1" width="100%">
  <tr>
    <td width="100%" background="logo.jpg">
      <table border="0" cellpadding="0" cellspacing="0" width="100%" bordercolor="#FFFFFF">
        <tr>
          <td width="100%" background="images/logo.jpg" height="80">
            <p align="center"><font color="#FFFFFF" size="4" face="Arial"><b>ParasiteDB - Research and Remove Parasites!</b></font></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="100%">
      <table border="1" cellpadding="5" cellspacing="5" width="100%" bordercolor="#FFFFFF">
        <tr>
          <td width="20%" valign="top">
        <font face="Arial" size="2"><b> Navigation</b></font><br>

            <font face="Arial" size="2">
           - <a href="http://parasitedb.freehostia.com/index.php">Home</a><br>
           - <a href="mailto:Webmaster@parasitedb.freehostia.com?subject=Contact Us">Contact Us</a><br>
				 - <a href="mailto:Webmaster@parasitedb.freehostia.com?subject=Advertise">Advertise</a><br>
           - <a href="http://parasitedb.freehostia.com/search.php">Search</a><br>
           - <a href="index.php">Staff Login</a><br>
           - <a href="view_online.php">View Users Online</a></font>

          <font face="Arial" size="1">
          <p>

          </font><font face="Arial" size="2">
				<font face="Arial" size="2">Google Ads Coming Soon!</font></a><font face="Arial" size="1">
          <p>

          <font face="Arial" size="2"><b> Sponsors</b></font><br>


				 </font><font face="Arial" size="2">- <a href="http://malwareremoval.com/">Malware Removal</a><br>
           - <a href="http://pchelpforum.com/">PC Help Forum</a><br>
            </font></td>
          <td width="80%" valign="top"><b><font face="Arial"><font size="2" color="#FFFFFF"><center><br>

<?php if (isset($_GET['addparasite'])): // User wants to add a joke
?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<label>Name:<br />
<textarea name="parasitename" rows="1" cols="50">
</textarea></label><br />
<label>From:<br />
<textarea name="parasitefrom" rows="1" cols="50">
</textarea></label><br />
<label>Genre:<br />
<textarea name="parasitegenre" rows="1" cols="50">
</textarea></label><br /
<label>Description:<br />
<textarea name="parasitedescription" rows="5" cols="50">
</textarea></label><br />
<label>Removal Info:<br />
<textarea name="parasiteremoval" rows="5" cols="50">
</textarea></label><br />
<input type="submit" value="Add" />
</form>

<?php else: // Default page display

$dbcnx = @mysql_connect('xxxxx', 'adaarm_db', 'xxxxx');
if (!$dbcnx) {
   exit('<p>Unable to connect to the ' .
       'database server at this time.</p>');
}

if (!@mysql_select_db('adaarm_db')) {
   exit('<p>Unable to locate the ' .
       'database at this time.</p>');
}

if (isset($_GET['edit']) {

    $edit_id = $_GET['edit'];
    unset($_GET['edit']);

    $query = "SELECT * FROM parasite WHERE id='$edit_id'";
    $result = mysql_query($query)or die(mysql_error());
    $data = mysql_fetch_assoc($result);
?>


   <fieldset><legend>Parasite Edit</legend>
   <form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
    <input type="hidden" name="id" value="<?php echo $data['id']; ?>">
   Parasitename:<input type="text" name="parasitename" value="<?php echo $data['parasitename']; ?>"><br />
    Parasitefrom:<input type="text" name"parasitefrom" value="<?php echo $data['parasitefrom']; ?>"><br />
    Parasitegenre:<input type="text" name="parasitegenre" value="<?php echo $data['parasitegenre']; ?>"><br />
    Parasitedescription:<input type="text" name="parasitedescription" value="<?php echo $data['parasitedescription']; ?>"><br />
    Parasiteremoval:<input type="text" name="parasiteremoval" value="<?php echo $data['parasiteremoval']; ?>"><br />
<input type="submit" value="Submit" name="parasiteedit">
</form>
</fieldset>

<?php
}

    if (isset($_REQUEST['parasiteedit'])) {
        $n = $_REQUEST['parasitename'];
        $f = $_REQUEST['parasitefrom'];
        $g = $_REQUEST['parasitegenre'];
        $d = $_REQUEST['parasitedescription'];
        $r = $_REQUEST['parasiteremoval'];
        $id= $_REQUEST['id'];

    $edit_sql = "UPDATE parasite SET
     parasitename='$n',
     parasitefrom='$f',
     parasitegenre='$g',
     parasitedescription='$d',
     parasiteremoval='$r'
     WHERE id='$id'";

    $result = mysql_query($edit_sql)or die(mysql_error());

        if ($result) {
            echo "The parasite named $edit_name has been changed.<br />
                     New values: <br />
                     Parasitename: $parasitename <br />
                     Parasitefrom: $parasitefrom <br />
                     Parasitegenre: $parasitegenre <br />
                     Parasitedescription: $parasitedescription <br />
                     Parasiteremoval: $parasiteremoval";
        }else{
            echo "The edit request could not be carried out.";
        }
}

if (isset($_GET['delete')) {
    $delete_id = $_GET['delete'];
    $delete_name = $_GET['name'];
    unset($_GET['name']);
    unset($_GET['delete']);
    $delete_sql = "DELETE * FROM parasite WHERE id='$delete_id'";
    $result = mysql_query($delete_sql)or die(mysql_error());

        if ($result) {
            echo "The parasite named $delete_name had been deleted.";
        }else{
            echo "The delete could not be carried out.";
        }
}

if (isset($_POST['parasitename'])) {
   $parasitename = $_POST['parasitename'];
   $parasitefrom = $_POST['parasitefrom'];
   $parasitegenre = $_POST['parasitegenre'];
   $parasitedescription = $_POST['parasitedescription'];
   $parasitetechremoval = $_POST['parasiteremoval'];
   $sql = "INSERT INTO parasite SET
       parasitename='$parasitename',
       parasitefrom='$parasitefrom',
       parasitegenre='$parasitegenre',
       parasitedescription='$parasitedescription',
       parasiteremoval='$parasiteremoval'";
   if (@mysql_query($sql)) {
     echo "<p>The parasite '$parasitename' has been added.</p>";
   } else {
     echo '<p>Error adding submitted parasite: ' .
         mysql_error() . '</p>';
   }
}

echo '<p><a href="' . $_SERVER['PHP_SELF'] .
     '?addparasite=1">Add a Parasite</a></p>';


$sql = mysql_query("SELECT parasitename,parasitefrom,parasitegenre,parasitedescription,parasiteremoval,id FROM parasite ORDER BY parasitename ASC") or die(mysql_error());

echo "Parasites in Database:<br><br>";
echo "<table width=90% align=center border=1><tr>
<td align=center>Name</td>
<td align=center>From</td>
<td align=center>Genre</td>
</tr>";

while ($r = mysql_fetch_array($sql)) { // Begin while
$id = $r["id"];
$name = $r["parasitename"];
$from = $r["parasitefrom"];
$genre = $r["parasitegenre"];
$description = $r["parasitegenre"];
$removal = $r["parasiteremoval"];

/* create a $_GET variable called delete using the objects id. Edit the this page link to the name of this page.*/

echo "<tr>
<td><a href=view.php?id=$id>$name</a></td>
<td>$from</td>
<td>$genre</td>
<td><a href='thispage.php?delete=$id&name=$name'>Delete</a></td>
<td><a href='thispage.php?edit=$id>Edit</a></tr>";
} // end while
echo "</table>";

endif;
?>

</table>

</center>
            </div>
            <p> </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="100%">
      <p align="center"><font size="2"><font face="Arial">All Site Content &copy 2007 - ParasiteDB<br>All Rights Reserved</font></td>
  </tr>
</table>
</BODY>
</html>

 

Thanks,

Adam

NOTE:

Parse error: parse error, unexpected '{' in /home/www/parasitedb.freehostia.com/staff/index.php on line 94

 

when you receive a message something like that its obvious that your missing or over use of the define character please check it first before posting

Ok, thanks. Now we are getting somewhere. Now we have another problem. The table that displays the parasites is all in one row and it has the first parasites name, from and genre and then it just keeps adding Delete and makes the page huge in width. Current code:

 

<html>
<head>
<title>ParasiteDB - Research and Remove Parasites!</title>
<META content="parasite, virus, malware, removal, computer, pc, database, pdb, db" name=keywords>
<META content="You can research and find ways to remove hundreds of different parasites here. Come take a look!" name=description>
<style TYPE="text/css">
A{text-decoration:none}
A:hover{color:#FFFFFF;text-decoration:underline}
}
BODY {
SCROLLBAR-FACE-COLOR: #000000; SCROLLBAR-HIGHLIGHT-COLOR: #000000; SCROLLBAR-SHADOW-COLOR: #0099CC; SCROLLBAR-3DLIGHT-COLOR: #0099CC; SCROLLBAR-ARROW-COLOR: #0099CC; SCROLLBAR-TRACK-COLOR: #000000; SCROLLBAR-DARKSHADOW-COLOR: #0000000;
}
</style>
</head>

<BODY BGCOLOR="#000000" TEXT="#FFFFFF" VLINK="#0099CC" ALINK="#0099CC" LINK="#0099CC" topmargin="0">

<table border="0" cellspacing="1" width="100%">
  <tr>
    <td width="100%" background="logo.jpg">
      <table border="0" cellpadding="0" cellspacing="0" width="100%" bordercolor="#FFFFFF">
        <tr>
          <td width="100%" background="images/logo.jpg" height="80">
            <p align="center"><font color="#FFFFFF" size="4" face="Arial"><b>ParasiteDB - Research and Remove Parasites!</b></font></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="100%">
      <table border="1" cellpadding="5" cellspacing="5" width="100%" bordercolor="#FFFFFF">
        <tr>
          <td width="20%" valign="top">
        <font face="Arial" size="2"><b> Navigation</b></font><br>

            <font face="Arial" size="2">
           - <a href="http://parasitedb.freehostia.com/index.php">Home</a><br>
           - <a href="mailto:Webmaster@parasitedb.freehostia.com?subject=Contact Us">Contact Us</a><br>
				 - <a href="mailto:Webmaster@parasitedb.freehostia.com?subject=Advertise">Advertise</a><br>
           - <a href="http://parasitedb.freehostia.com/search.php">Search</a><br>
           - <a href="index.php">Staff Login</a><br>
           - <a href="view_online.php">View Users Online</a></font>

          <font face="Arial" size="1">
          <p>

          </font><font face="Arial" size="2">
				<font face="Arial" size="2">Google Ads Coming Soon!</font></a><font face="Arial" size="1">
          <p>

          <font face="Arial" size="2"><b> Sponsors</b></font><br>


				 </font><font face="Arial" size="2">- <a href="http://malwareremoval.com/">Malware Removal</a><br>
           - <a href="http://pchelpforum.com/">PC Help Forum</a><br>
            </font></td>
          <td width="80%" valign="top"><b><font face="Arial"><font size="2" color="#FFFFFF"><center><br>

<?php if (isset($_GET['addparasite'])): // User wants to add a joke
?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<label>Name:<br />
<textarea name="parasitename" rows="1" cols="50">
</textarea></label><br />
<label>From:<br />
<textarea name="parasitefrom" rows="1" cols="50">
</textarea></label><br />
<label>Genre:<br />
<textarea name="parasitegenre" rows="1" cols="50">
</textarea></label><br /
<label>Description:<br />
<textarea name="parasitedescription" rows="5" cols="50">
</textarea></label><br />
<label>Removal Info:<br />
<textarea name="parasiteremoval" rows="5" cols="50">
</textarea></label><br />
<input type="submit" value="Add" />
</form>

<?php else: // Default page display

$dbcnx = @mysql_connect('xxx', 'adaarm_db', 'xxx');
if (!$dbcnx) {
   exit('<p>Unable to connect to the ' .
       'database server at this time.</p>');
}

if (!@mysql_select_db('adaarm_db')) {
   exit('<p>Unable to locate the ' .
       'database at this time.</p>');
}

if (isset($_GET['edit'])) {

    $edit_id = $_GET['edit'];
    unset($_GET['edit']);

    $query = "SELECT * FROM parasite WHERE id='$edit_id'";
    $result = mysql_query($query)or die(mysql_error());
    $data = mysql_fetch_assoc($result);
?>


   <fieldset><legend>Parasite Edit</legend>
   <form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
    <input type="hidden" name="id" value="<?php echo $data['id']; ?>">
   Parasitename:<input type="text" name="parasitename" value="<?php echo $data['parasitename']; ?>"><br />
    Parasitefrom:<input type="text" name"parasitefrom" value="<?php echo $data['parasitefrom']; ?>"><br />
    Parasitegenre:<input type="text" name="parasitegenre" value="<?php echo $data['parasitegenre']; ?>"><br />
    Parasitedescription:<input type="text" name="parasitedescription" value="<?php echo $data['parasitedescription']; ?>"><br />
    Parasiteremoval:<input type="text" name="parasiteremoval" value="<?php echo $data['parasiteremoval']; ?>"><br />
<input type="submit" value="Submit" name="parasiteedit">
</form>
</fieldset>

<?php
}

    if (isset($_REQUEST['parasiteedit'])) {
        $n = $_REQUEST['parasitename'];
        $f = $_REQUEST['parasitefrom'];
        $g = $_REQUEST['parasitegenre'];
        $d = $_REQUEST['parasitedescription'];
        $r = $_REQUEST['parasiteremoval'];
        $id= $_REQUEST['id'];

    $edit_sql = "UPDATE parasite SET
     parasitename='$n',
     parasitefrom='$f',
     parasitegenre='$g',
     parasitedescription='$d',
     parasiteremoval='$r'
     WHERE id='$id'";

    $result = mysql_query($edit_sql)or die(mysql_error());

        if ($result) {
            echo "The parasite named $edit_name has been changed.<br />
                     New values: <br />
                     Parasitename: $parasitename <br />
                     Parasitefrom: $parasitefrom <br />
                     Parasitegenre: $parasitegenre <br />
                     Parasitedescription: $parasitedescription <br />
                     Parasiteremoval: $parasiteremoval";
        }else{
            echo "The edit request could not be carried out.";
        }
}

if (isset($_GET['delete'])) {
    $delete_id = $_GET['delete'];
    $delete_name = $_GET['name'];
    unset($_GET['name']);
    unset($_GET['delete']);
    $delete_sql = "DELETE * FROM parasite WHERE id='$delete_id'";
    $result = mysql_query($delete_sql)or die(mysql_error());

        if ($result) {
            echo "The parasite named $delete_name had been deleted.";
        }else{
            echo "The delete could not be carried out.";
        }
}

if (isset($_POST['parasitename'])) {
   $parasitename = $_POST['parasitename'];
   $parasitefrom = $_POST['parasitefrom'];
   $parasitegenre = $_POST['parasitegenre'];
   $parasitedescription = $_POST['parasitedescription'];
   $parasitetechremoval = $_POST['parasiteremoval'];
   $sql = "INSERT INTO parasite SET
       parasitename='$parasitename',
       parasitefrom='$parasitefrom',
       parasitegenre='$parasitegenre',
       parasitedescription='$parasitedescription',
       parasiteremoval='$parasiteremoval'";
   if (@mysql_query($sql)) {
     echo "<p>The parasite '$parasitename' has been added.</p>";
   } else {
     echo '<p>Error adding submitted parasite: ' .
         mysql_error() . '</p>';
   }
}

include'notes.php';

echo '<p><a href="' . $_SERVER['PHP_SELF'] .
     '?addparasite=1">Add a Parasite</a></p>';


$sql = mysql_query("SELECT parasitename,parasitefrom,parasitegenre,parasitedescription,parasiteremoval,id FROM parasite ORDER BY parasitename ASC") or die(mysql_error());

echo "Parasites in Database:<br><br>";
echo "<table width=90% align=center border=1><tr>
<td align=center>Name</td>
<td align=center>From</td>
<td align=center>Genre</td>
</tr>";

while ($r = mysql_fetch_array($sql)) { // Begin while
$id = $r["id"];
$name = $r["parasitename"];
$from = $r["parasitefrom"];
$genre = $r["parasitegenre"];
$description = $r["parasitegenre"];
$removal = $r["parasiteremoval"];

/* create a $_GET variable called delete using the objects id. Edit the this page link to the name of this page.*/

echo "<tr>
<td><a href=view.php?id=$id>$name</a></td>
<td>$from</td>
<td>$genre</td>
<td><a href='thispage.php?delete=$id&name=$name'>Delete</a></td>
<td><a href='thispage.php?edit=$id>Edit</a></tr>";
} // end while
echo "</table>";

endif;
?>

</table>

</center>
            </div>
            <p> </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="100%">
      <p align="center"><font size="2"><font face="Arial">All Site Content &copy 2007 - ParasiteDB<br>All Rights Reserved</font></td>
  </tr>
</table>
</BODY>
</html>

 

Thanks,

Adam

<html>
<head>
<title>ParasiteDB - Research and Remove Parasites!</title>
<META content="parasite, virus, malware, removal, computer, pc, database, pdb, db" name=keywords>
<META content="You can research and find ways to remove hundreds of different parasites here. Come take a look!" name=description>
<style TYPE="text/css">
A{text-decoration:none}
A:hover{color:#FFFFFF;text-decoration:underline}
}
BODY {
SCROLLBAR-FACE-COLOR: #000000; SCROLLBAR-HIGHLIGHT-COLOR: #000000; SCROLLBAR-SHADOW-COLOR: #0099CC; SCROLLBAR-3DLIGHT-COLOR: #0099CC; SCROLLBAR-ARROW-COLOR: #0099CC; SCROLLBAR-TRACK-COLOR: #000000; SCROLLBAR-DARKSHADOW-COLOR: #0000000;
}
</style>
</head>

<BODY BGCOLOR="#000000" TEXT="#FFFFFF" VLINK="#0099CC" ALINK="#0099CC" LINK="#0099CC" topmargin="0">

<table border="0" cellspacing="1" width="100%">
  <tr>
    <td width="100%" background="logo.jpg">
      <table border="0" cellpadding="0" cellspacing="0" width="100%" bordercolor="#FFFFFF">
        <tr>
          <td width="100%" background="images/logo.jpg" height="80">
            <p align="center"><font color="#FFFFFF" size="4" face="Arial"><b>ParasiteDB - Research and Remove Parasites!</b></font></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="100%">
      <table border="1" cellpadding="5" cellspacing="5" width="100%" bordercolor="#FFFFFF">
        <tr>
          <td width="20%" valign="top">
        <font face="Arial" size="2"><b> Navigation</b></font><br>

            <font face="Arial" size="2">
           - <a href="http://parasitedb.freehostia.com/index.php">Home</a><br>
           - <a href="mailto:Webmaster@parasitedb.freehostia.com?subject=Contact Us">Contact Us</a><br>
				 - <a href="mailto:Webmaster@parasitedb.freehostia.com?subject=Advertise">Advertise</a><br>
           - <a href="http://parasitedb.freehostia.com/search.php">Search</a><br>
           - <a href="index.php">Staff Login</a><br>
           - <a href="view_online.php">View Users Online</a></font>

          <font face="Arial" size="1">
          <p>

          </font><font face="Arial" size="2">
				<font face="Arial" size="2">Google Ads Coming Soon!</font></a><font face="Arial" size="1">
          <p>

          <font face="Arial" size="2"><b> Sponsors</b></font><br>


				 </font><font face="Arial" size="2">- <a href="http://malwareremoval.com/">Malware Removal</a><br>
           - <a href="http://pchelpforum.com/">PC Help Forum</a><br>
            </font></td>
          <td width="80%" valign="top"><b><font face="Arial"><font size="2" color="#FFFFFF"><center><br>

<?php if (isset($_GET['addparasite'])): // User wants to add a joke
?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<label>Name:<br />
<textarea name="parasitename" rows="1" cols="50">
</textarea></label><br />
<label>From:<br />
<textarea name="parasitefrom" rows="1" cols="50">
</textarea></label><br />
<label>Genre:<br />
<textarea name="parasitegenre" rows="1" cols="50">
</textarea></label><br /
<label>Description:<br />
<textarea name="parasitedescription" rows="5" cols="50">
</textarea></label><br />
<label>Removal Info:<br />
<textarea name="parasiteremoval" rows="5" cols="50">
</textarea></label><br />
<input type="submit" value="Add" />
</form>

<?php else: // Default page display

$dbcnx = @mysql_connect('xxx', 'adaarm_db', 'xxx');
if (!$dbcnx) {
   exit('<p>Unable to connect to the ' .
       'database server at this time.</p>');
}

if (!@mysql_select_db('adaarm_db')) {
   exit('<p>Unable to locate the ' .
       'database at this time.</p>');
}

if (isset($_GET['edit'])) {

    $edit_id = $_GET['edit'];
    unset($_GET['edit']);

    $query = "SELECT * FROM parasite WHERE id='$edit_id'";
    $result = mysql_query($query)or die(mysql_error());
    $data = mysql_fetch_assoc($result);
?>


   <fieldset><legend>Parasite Edit</legend>
   <form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
    <input type="hidden" name="id" value="<?php echo $data['id']; ?>">
   Parasitename:<input type="text" name="parasitename" value="<?php echo $data['parasitename']; ?>"><br />
    Parasitefrom:<input type="text" name"parasitefrom" value="<?php echo $data['parasitefrom']; ?>"><br />
    Parasitegenre:<input type="text" name="parasitegenre" value="<?php echo $data['parasitegenre']; ?>"><br />
    Parasitedescription:<input type="text" name="parasitedescription" value="<?php echo $data['parasitedescription']; ?>"><br />
    Parasiteremoval:<input type="text" name="parasiteremoval" value="<?php echo $data['parasiteremoval']; ?>"><br />
<input type="submit" value="Submit" name="parasiteedit">
</form>
</fieldset>

<?php
}

    if (isset($_REQUEST['parasiteedit'])) {
        $n = $_REQUEST['parasitename'];
        $f = $_REQUEST['parasitefrom'];
        $g = $_REQUEST['parasitegenre'];
        $d = $_REQUEST['parasitedescription'];
        $r = $_REQUEST['parasiteremoval'];
        $id= $_REQUEST['id'];

    $edit_sql = "UPDATE parasite SET
     parasitename='$n',
     parasitefrom='$f',
     parasitegenre='$g',
     parasitedescription='$d',
     parasiteremoval='$r'
     WHERE id='$id'";

    $result = mysql_query($edit_sql)or die(mysql_error());

        if ($result) {
            echo "The parasite named $edit_name has been changed.<br />
                     New values: <br />
                     Parasitename: $parasitename <br />
                     Parasitefrom: $parasitefrom <br />
                     Parasitegenre: $parasitegenre <br />
                     Parasitedescription: $parasitedescription <br />
                     Parasiteremoval: $parasiteremoval";
        }else{
            echo "The edit request could not be carried out.";
        }
}

if (isset($_GET['delete'])) {
    $delete_id = $_GET['delete'];
    $delete_name = $_GET['name'];
    unset($_GET['name']);
    unset($_GET['delete']);
    $delete_sql = "DELETE * FROM parasite WHERE id='$delete_id'";
    $result = mysql_query($delete_sql)or die(mysql_error());

        if ($result) {
            echo "The parasite named $delete_name had been deleted.";
        }else{
            echo "The delete could not be carried out.";
        }
}

if (isset($_POST['parasitename'])) {
   $parasitename = $_POST['parasitename'];
   $parasitefrom = $_POST['parasitefrom'];
   $parasitegenre = $_POST['parasitegenre'];
   $parasitedescription = $_POST['parasitedescription'];
   $parasitetechremoval = $_POST['parasiteremoval'];
   $sql = "INSERT INTO parasite SET
       parasitename='$parasitename',
       parasitefrom='$parasitefrom',
       parasitegenre='$parasitegenre',
       parasitedescription='$parasitedescription',
       parasiteremoval='$parasiteremoval'";
   if (@mysql_query($sql)) {
     echo "<p>The parasite '$parasitename' has been added.</p>";
   } else {
     echo '<p>Error adding submitted parasite: ' .
         mysql_error() . '</p>';
   }
}

include'notes.php';

echo '<p><a href="' . $_SERVER['PHP_SELF'] .
     '?addparasite=1">Add a Parasite</a></p>';


$sql = mysql_query("SELECT parasitename,parasitefrom,parasitegenre,parasitedescription,parasiteremoval,id FROM parasite ORDER BY parasitename ASC") or die(mysql_error());

echo "Parasites in Database:<br><br>";
echo "<table width=90% align=center border=1><tr>
<td align=center>Name</td>
<td align=center>From</td>
<td align=center>Genre</td>
</tr>";

while ($r = mysql_fetch_array($sql)) { // Begin while
$id = $r["id"];
$name = $r["parasitename"];
$from = $r["parasitefrom"];
$genre = $r["parasitegenre"];
$description = $r["parasitegenre"];
$removal = $r["parasiteremoval"];

/* create a $_GET variable called delete using the objects id. Edit the this page link to the name of this page.*/

echo "<tr>
	<td><a href=view.php?id=$id>$name</a></td>
	<td>$from</td>
	<td>$genre</td>
	<td><a href='thispage.php?delete=$id&name=$name'>Delete</a></td>
	<td><a href='thispage.php?edit=$id>Edit</a></td>
</tr>";
} // end while
echo "</table>";

endif;
?>

</table>

</center>
            </div>
            <p> </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="100%">
      <p align="center"><font size="2"><font face="Arial">All Site Content &copy 2007 - ParasiteDB<br>All Rights Reserved</font></td>
  </tr>
</table>
</BODY>
</html>

 

you missed </td> indent your code properly to avoid syntax error

It all looks good now! Thanks all!! But now upon trying to delete I get this error:

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* FROM parasite WHERE id='32'' at line 1

 

Upon edit it added a new one with the same values and edited the old one but removed the from data. Wierd.

 

Page code:

 

<html>
<head>
<title>ParasiteDB - Research and Remove Parasites!</title>
<META content="parasite, virus, malware, removal, computer, pc, database, pdb, db" name=keywords>
<META content="You can research and find ways to remove hundreds of different parasites here. Come take a look!" name=description>
<style TYPE="text/css">
A{text-decoration:none}
A:hover{color:#FFFFFF;text-decoration:underline}
}
BODY {
SCROLLBAR-FACE-COLOR: #000000; SCROLLBAR-HIGHLIGHT-COLOR: #000000; SCROLLBAR-SHADOW-COLOR: #0099CC; SCROLLBAR-3DLIGHT-COLOR: #0099CC; SCROLLBAR-ARROW-COLOR: #0099CC; SCROLLBAR-TRACK-COLOR: #000000; SCROLLBAR-DARKSHADOW-COLOR: #0000000;
}
</style>
</head>

<BODY BGCOLOR="#000000" TEXT="#FFFFFF" VLINK="#0099CC" ALINK="#0099CC" LINK="#0099CC" topmargin="0">

<table border="0" cellspacing="1" width="100%">
  <tr>
    <td width="100%" background="logo.jpg">
      <table border="0" cellpadding="0" cellspacing="0" width="100%" bordercolor="#FFFFFF">
        <tr>
          <td width="100%" background="images/logo.jpg" height="80">
            <p align="center"><font color="#FFFFFF" size="4" face="Arial"><b>ParasiteDB - Research and Remove Parasites!</b></font></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="100%">
      <table border="1" cellpadding="5" cellspacing="5" width="100%" bordercolor="#FFFFFF">
        <tr>
          <td width="20%" valign="top">
        <font face="Arial" size="2"><b> Navigation</b></font><br>

            <font face="Arial" size="2">
           - <a href="http://parasitedb.freehostia.com/index.php">Home</a><br>
           - <a href="mailto:Webmaster@parasitedb.freehostia.com?subject=Contact Us">Contact Us</a><br>
				 - <a href="mailto:Webmaster@parasitedb.freehostia.com?subject=Advertise">Advertise</a><br>
           - <a href="http://parasitedb.freehostia.com/search.php">Search</a><br>
           - <a href="index.php">Staff Login</a><br>
           - <a href="view_online.php">View Users Online</a></font>

          <font face="Arial" size="1">
          <p>

          </font><font face="Arial" size="2">
				<font face="Arial" size="2">Google Ads Coming Soon!</font></a><font face="Arial" size="1">
          <p>

          <font face="Arial" size="2"><b> Sponsors</b></font><br>


				 </font><font face="Arial" size="2">- <a href="http://malwareremoval.com/">Malware Removal</a><br>
           - <a href="http://pchelpforum.com/">PC Help Forum</a><br>
            </font></td>
          <td width="80%" valign="top"><b><font face="Arial"><font size="2" color="#FFFFFF"><center><br>

<?php if (isset($_GET['addparasite'])): // User wants to add a joke
?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<label>Name:<br />
<textarea name="parasitename" rows="1" cols="50">
</textarea></label><br />
<label>From:<br />
<textarea name="parasitefrom" rows="1" cols="50">
</textarea></label><br />
<label>Genre:<br />
<textarea name="parasitegenre" rows="1" cols="50">
</textarea></label><br /
<label>Description:<br />
<textarea name="parasitedescription" rows="5" cols="50">
</textarea></label><br />
<label>Removal Info:<br />
<textarea name="parasiteremoval" rows="5" cols="50">
</textarea></label><br />
<input type="submit" value="Add" />
</form>

<?php else: // Default page display

$dbcnx = @mysql_connect('xxx', 'adaarm_db', 'xxx');
if (!$dbcnx) {
   exit('<p>Unable to connect to the ' .
       'database server at this time.</p>');
}

if (!@mysql_select_db('adaarm_db')) {
   exit('<p>Unable to locate the ' .
       'database at this time.</p>');
}

if (isset($_GET['edit'])) {

    $edit_id = $_GET['edit'];
    unset($_GET['edit']);

    $query = "SELECT * FROM parasite WHERE id='$edit_id'";
    $result = mysql_query($query)or die(mysql_error());
    $data = mysql_fetch_assoc($result);
?>


   <fieldset><legend>Parasite Edit</legend>
   <form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
    <input type="hidden" name="id" value="<?php echo $data['id']; ?>">
   Parasitename:<input type="text" name="parasitename" value="<?php echo $data['parasitename']; ?>"><br />
    Parasitefrom:<input type="text" name"parasitefrom" value="<?php echo $data['parasitefrom']; ?>"><br />
    Parasitegenre:<input type="text" name="parasitegenre" value="<?php echo $data['parasitegenre']; ?>"><br />
    Parasitedescription:<input type="text" name="parasitedescription" value="<?php echo $data['parasitedescription']; ?>"><br />
    Parasiteremoval:<input type="text" name="parasiteremoval" value="<?php echo $data['parasiteremoval']; ?>"><br />
<input type="submit" value="Submit" name="parasiteedit">
</form>
</fieldset>

<?php
}

    if (isset($_REQUEST['parasiteedit'])) {
        $n = $_REQUEST['parasitename'];
        $f = $_REQUEST['parasitefrom'];
        $g = $_REQUEST['parasitegenre'];
        $d = $_REQUEST['parasitedescription'];
        $r = $_REQUEST['parasiteremoval'];
        $id= $_REQUEST['id'];

    $edit_sql = "UPDATE parasite SET
     parasitename='$n',
     parasitefrom='$f',
     parasitegenre='$g',
     parasitedescription='$d',
     parasiteremoval='$r'
     WHERE id='$id'";

    $result = mysql_query($edit_sql)or die(mysql_error());

        if ($result) {
            echo "The parasite named $edit_name has been changed.<br />
                     New values: <br />
                     Parasitename: $parasitename <br />
                     Parasitefrom: $parasitefrom <br />
                     Parasitegenre: $parasitegenre <br />
                     Parasitedescription: $parasitedescription <br />
                     Parasiteremoval: $parasiteremoval";
        }else{
            echo "The edit request could not be carried out.";
        }
}

if (isset($_GET['delete'])) {
    $delete_id = $_GET['delete'];
    $delete_name = $_GET['name'];
    unset($_GET['name']);
    unset($_GET['delete']);
    $delete_sql = "DELETE * FROM parasite WHERE id='$delete_id'";
    $result = mysql_query($delete_sql)or die(mysql_error());

        if ($result) {
            echo "The parasite named $delete_name had been deleted.";
        }else{
            echo "The delete could not be carried out.";
        }
}

if (isset($_POST['parasitename'])) {
   $parasitename = $_POST['parasitename'];
   $parasitefrom = $_POST['parasitefrom'];
   $parasitegenre = $_POST['parasitegenre'];
   $parasitedescription = $_POST['parasitedescription'];
   $parasitetechremoval = $_POST['parasiteremoval'];
   $sql = "INSERT INTO parasite SET
       parasitename='$parasitename',
       parasitefrom='$parasitefrom',
       parasitegenre='$parasitegenre',
       parasitedescription='$parasitedescription',
       parasiteremoval='$parasiteremoval'";
   if (@mysql_query($sql)) {
     echo "<p>The parasite '$parasitename' has been added.</p>";
   } else {
     echo '<p>Error adding submitted parasite: ' .
         mysql_error() . '</p>';
   }
}

echo '<p><a href="' . $_SERVER['PHP_SELF'] .
     '?addparasite=1">Add a Parasite</a></p>';


$sql = mysql_query("SELECT parasitename,parasitefrom,parasitegenre,parasitedescription,parasiteremoval,id FROM parasite ORDER BY parasitename ASC") or die(mysql_error());

echo "Parasites in Database:<br><br>";
echo "<table width=90% align=center border=1><tr>
<td align=center>Name</td>
<td align=center>From</td>
<td align=center>Genre</td>
</tr>";

while ($r = mysql_fetch_array($sql)) { // Begin while
$id = $r["id"];
$name = $r["parasitename"];
$from = $r["parasitefrom"];
$genre = $r["parasitegenre"];
$description = $r["parasitegenre"];
$removal = $r["parasiteremoval"];

/* create a $_GET variable called delete using the objects id. Edit the this page link to the name of this page.*/

echo "<tr>
	<td><a href=view.php?id=$id>$name</a></td>
	<td>$from</td>
	<td>$genre</td>
	<td><a href='thispage.php?delete=$id&name=$name'>Delete</a></td>
	<td><a href='thispage.php?edit=$id'>Edit</a></td></tr>";
} // end while
echo "</table>";

endif;
?>

</table>

</center>
            </div>
            <p> </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="100%">
      <p align="center"><font size="2"><font face="Arial">All Site Content &copy 2007 - ParasiteDB<br>All Rights Reserved</font></td>
  </tr>
</table>
</BODY>
</html>

 

All help appreciated.

 

Thanks,

Adam

Ok all I need fixed now is that delete. I don't understand why that isn't working. The edit and add I fixed and are working great, thanks!! Now lets see if we can get that dang delete to work. Any ideas? =/ New code:

 

<html>
<head>
<title>ParasiteDB - Research and Remove Parasites!</title>
<META content="parasite, virus, malware, removal, computer, pc, database, pdb, db" name=keywords>
<META content="You can research and find ways to remove hundreds of different parasites here. Come take a look!" name=description>
<style TYPE="text/css">
A{text-decoration:none}
A:hover{color:#FFFFFF;text-decoration:underline}
}
BODY {
SCROLLBAR-FACE-COLOR: #000000; SCROLLBAR-HIGHLIGHT-COLOR: #000000; SCROLLBAR-SHADOW-COLOR: #0099CC; SCROLLBAR-3DLIGHT-COLOR: #0099CC; SCROLLBAR-ARROW-COLOR: #0099CC; SCROLLBAR-TRACK-COLOR: #000000; SCROLLBAR-DARKSHADOW-COLOR: #0000000;
}
</style>
</head>

<BODY BGCOLOR="#000000" TEXT="#FFFFFF" VLINK="#0099CC" ALINK="#0099CC" LINK="#0099CC" topmargin="0">

<table border="0" cellspacing="1" width="100%">
  <tr>
    <td width="100%" background="logo.jpg">
      <table border="0" cellpadding="0" cellspacing="0" width="100%" bordercolor="#FFFFFF">
        <tr>
          <td width="100%" background="images/logo.jpg" height="80">
            <p align="center"><font color="#FFFFFF" size="4" face="Arial"><b>ParasiteDB - Research and Remove Parasites!</b></font></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="100%">
      <table border="1" cellpadding="5" cellspacing="5" width="100%" bordercolor="#FFFFFF">
        <tr>
          <td width="20%" valign="top">
        <font face="Arial" size="2"><b> Navigation</b></font><br>

            <font face="Arial" size="2">
           - <a href="http://parasitedb.freehostia.com/index.php">Home</a><br>
           - <a href="mailto:Webmaster@parasitedb.freehostia.com?subject=Contact Us">Contact Us</a><br>
				 - <a href="mailto:Webmaster@parasitedb.freehostia.com?subject=Advertise">Advertise</a><br>
           - <a href="http://parasitedb.freehostia.com/search.php">Search</a><br>
           - <a href="index.php">Staff Login</a><br>
           - <a href="view_online.php">View Users Online</a></font>

          <font face="Arial" size="1">
          <p>

          </font><font face="Arial" size="2">
				<font face="Arial" size="2">Google Ads Coming Soon!</font></a><font face="Arial" size="1">
          <p>

          <font face="Arial" size="2"><b> Sponsors</b></font><br>


				 </font><font face="Arial" size="2">- <a href="http://malwareremoval.com/">Malware Removal</a><br>
           - <a href="http://pchelpforum.com/">PC Help Forum</a><br>
            </font></td>
          <td width="80%" valign="top"><b><font face="Arial"><font size="2" color="#FFFFFF"><center><br>

<?php if (isset($_GET['addparasite'])): 
?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<label>Name:<br />
<textarea name="parasitename" rows="1" cols="50">
</textarea></label><br />
<label>From:<br />
<textarea name="parasitefrom" rows="1" cols="50">
</textarea></label><br />
<label>Genre:<br />
<textarea name="parasitegenre" rows="1" cols="50">
</textarea></label><br /
<label>Description:<br />
<textarea name="parasitedescription" rows="5" cols="50">
</textarea></label><br />
<label>Removal Info:<br />
<textarea name="parasiteremoval" rows="5" cols="50">
</textarea></label><br />
<input type="submit" value="Add" name="parasiteadd" />
</form>

<?php else: // Default page display

$dbcnx = @mysql_connect('xxx', 'adaarm_db', 'xxx');
if (!$dbcnx) {
   exit('<p>Unable to connect to the ' .
       'database server at this time.</p>');
}

if (!@mysql_select_db('adaarm_db')) {
   exit('<p>Unable to locate the ' .
       'database at this time.</p>');
}

if (isset($_GET['edit'])) {

    $edit_id = $_GET['edit'];
    unset($_GET['edit']);

    $query = "SELECT * FROM parasite WHERE id='$edit_id'";
    $result = mysql_query($query)or die(mysql_error());
    $data = mysql_fetch_assoc($result);
?>


   <fieldset><legend>Parasite Edit</legend>
   <form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
    <input type="hidden" name="id" value="<?php echo $data['id']; ?>">
   Parasitename:<input type="text" name="parasitename" value="<?php echo $data['parasitename']; ?>"><br />
    Parasitefrom:<input type="text" name="parasitefrom" value="<?php echo $data['parasitefrom']; ?>"><br />
    Parasitegenre:<input type="text" name="parasitegenre" value="<?php echo $data['parasitegenre']; ?>"><br />
    Parasitedescription:<input type="text" name="parasitedescription" value="<?php echo $data['parasitedescription']; ?>"><br />
    Parasiteremoval:<input type="text" name="parasiteremoval" value="<?php echo $data['parasiteremoval']; ?>"><br />
<input type="submit" value="Submit" name="parasiteedit">
</form>
</fieldset>

<?php
}

    if (isset($_REQUEST['parasiteedit'])) {
        $n = $_REQUEST['parasitename'];
        $f = $_REQUEST['parasitefrom'];
        $g = $_REQUEST['parasitegenre'];
        $d = $_REQUEST['parasitedescription'];
        $r = $_REQUEST['parasiteremoval'];
        $id= $_REQUEST['id'];

    $edit_sql = "UPDATE parasite SET
     parasitename='$n',
     parasitefrom='$f',
     parasitegenre='$g',
     parasitedescription='$d',
     parasiteremoval='$r'
     WHERE id='$id'";

    $result = mysql_query($edit_sql)or die(mysql_error());

        if ($result) {
            echo "The parasite named $edit_name has been changed.<br />
                     New values: <br />
                     Parasitename: $parasitename <br />
                     Parasitefrom: $parasitefrom <br />
                     Parasitegenre: $parasitegenre <br />
                     Parasitedescription: $parasitedescription <br />
                     Parasiteremoval: $parasiteremoval";
        }else{
            echo "The edit request could not be carried out.";
        }
}

if (isset($_GET['delete'])) {
    $delete_id = $_GET['delete'];
    unset($_GET['delete']);
    $delete_sql = "DELETE * FROM parasite WHERE id='$delete_id'";
    $result = mysql_query($delete_sql)or die(mysql_error());

        if ($result) {
            echo "The parasite has been deleted.";
        }
        else {
            echo "The delete could not be carried out.";
        }
}

if (isset($_POST['parasiteadd'])) {
   $parasitename = $_POST['parasitename'];
   $parasitefrom = $_POST['parasitefrom'];
   $parasitegenre = $_POST['parasitegenre'];
   $parasitedescription = $_POST['parasitedescription'];
   $parasitetechremoval = $_POST['parasiteremoval'];
   $sql = "INSERT INTO parasite SET
       parasitename='$parasitename',
       parasitefrom='$parasitefrom',
       parasitegenre='$parasitegenre',
       parasitedescription='$parasitedescription',
       parasiteremoval='$parasiteremoval'";
   if (@mysql_query($sql)) {
     echo "<p>The parasite '$parasitename' has been added.</p>";
   } else {
     echo '<p>Error adding submitted parasite: ' .
         mysql_error() . '</p>';
   }
}

echo '<p><a href="' . $_SERVER['PHP_SELF'] .
     '?addparasite=1">Add a Parasite</a></p>';


$sql = mysql_query("SELECT parasitename,parasitefrom,parasitegenre,parasitedescription,parasiteremoval,id FROM parasite ORDER BY parasitename ASC") or die(mysql_error());

echo "Parasites in Database:<br><br>";
echo "<table width=90% align=center border=1><tr>
<td align=center>Name</td>
<td align=center>From</td>
<td align=center>Genre</td>
<td align=center>Delete</td>
<td align=center>Edit</td>
</tr>";

while ($r = mysql_fetch_array($sql)) { // Begin while
$id = $r["id"];
$name = $r["parasitename"];
$from = $r["parasitefrom"];
$genre = $r["parasitegenre"];
$description = $r["parasitegenre"];
$removal = $r["parasiteremoval"];

/* create a $_GET variable called delete using the objects id. Edit the this page link to the name of this page.*/

echo "<tr>
	<td><a href=view.php?id=$id>$name</a></td>
	<td>$from</td>
	<td>$genre</td>
	<td><a href='index.php?delete=$id'>Delete</a></td>
	<td><a href='index.php?edit=$id'>Edit</a></td></tr>";
} // end while
echo "</table>";

endif;
?>

</table>

</center>
            </div>
            <p> </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="100%">
      <p align="center"><font size="2"><font face="Arial">All Site Content &copy 2007 - ParasiteDB<br>All Rights Reserved</font></td>
  </tr>
</table>
</BODY>
</html>

 

Thanks for all of your help,

Adam

Thank you so much!! As that is a sensitive link and deletes without any confirmation.. how could I make a popup message before it executes it? Like it does a popup box that says Are you sure you want to delete? Ok or Cancel (or something like that) as the buttons and Cancel just keeps them on the page like nothing happened and Ok will go ahead and delete it.

 

Thanks,

Adam

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.