Updating and deleting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Why won't this work?




<html>
<title>Edit Show List</title>
<body>
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("websitedb",$db);



if($sent) {

 $sql = "UPDATE bp set sent=$sent where fname=$fname AND lname=$lname";
 mysql_query($sql);
 ?> Sent<br><a href="http://twostep.antsmarching.org/bpedit.php3";>Back</a> <?php

}else if($received) {

 $sql = "UPDATE bp set received=$received where fname=$fname AND lname=$lnam;";
 mysql_query($sql);
 ?> Received<br><a href="http://twostep.antsmarching.org/bpedit.php3";>Back</a> <?php

} else if($delete) {

 $sql = "DELETE FROM bp WHERE lname=$lname AND fname=$fname";
 mysql_query($sql);
 ?> Delete<br><a href="http://twostep.antsmarching.org/bpedit.php3";>Back</a> <?php
}


$result = mysql_query("SELECT * FROM bp ORDER by showdate", $db);

echo "<table border=1 align=center>\n";

echo "<tr><td align=center>Date</td><td align=center>Name</td><td align=center>Address 1</td><td align=center>Address 2</td><td align=center>City, State Zip</td><td>Received</td><td>Sent</td><td>Edit</td></tr>";


while($myrow = mysql_fetch_row($result))
{
 printf("<tr><td>%s</td><td>%s %s</td><td>%s</td><td>%s</td><td>%s, %s %s</td><td>%s</td><td>%s</td>", $myrow[7], $myrow[1], $myrow[0], $myrow[2], $myrow[3], $myrow[4], $myrow[5], $myrow[6], $myrow[8], $myrow[9]);
 printf("<td><a href=\"%s?lname=%s&fname=%s&received=yes\">Received</a>", $PHP_SELF, $myrow[0], $myrow[1]);
 printf("<br><a href=\"%s?lname=%s&fname=%s&sent=yes\">sent</a>", $PHP_SELF, $myrow[0], $myrow[1]);
 printf("<br><a href=\"%s?lname=%s&fname=%s&delete=yes\">Delete</a></td></tr>", $PHP_SELF, $myrow[0], $myrow[1]);
}



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux