This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.
<table>
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Date</th>
<th scope="col">Name</th>
<th scope="col">Amount</th>
<th scope="col">Notes</th>
<th scope="col">Delete</th>
</tr>
</thead>
<tbody>
<?php
require('db.php');
$result = mysql_query("SELECT idnumber, date, name, amount, notes FROM orders")
or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
?>
<tr>
<td><?php echo "".$row['idnumber']; ?></td>
<td><?php echo "".$row['date']; ?></td>
<td><?php echo "".$row['name']; ?></td>
<td><?php echo "".$row['amount']; ?></td>
<td><?php echo "".$row['notes']; ?></td>
<td><a href="<?php //delete this row ?>">delete</a></td>
</tr>
<?php } ?>
</tbody>
</table>
Experts Exchange Solution brought to you by
"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.
<table>
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Date</th>
<th scope="col">Name</th>
<th scope="col">Amount</th>
<th scope="col">Notes</th>
<th scope="col">Delete</th>
</tr>
</thead>
<tbody>
<?php
require('db.php');
$query="SELECT idnumber, date, name, amount, notes FROM orders";
if("d"==strval($_REQUEST['op']) && is_numeric($_REQUEST['id']) )
{
$query="DELETE FROM `orders` WHERE `idnumber`=" . $_REQUEST['id'];
}
$result = mysql_query($query)
or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
?>
<tr>
<td><?php echo "".$row['idnumber']; ?></td>
<td><?php echo "".$row['date']; ?></td>
<td><?php echo "".$row['name']; ?></td>
<td><?php echo "".$row['amount']; ?></td>
<td><?php echo "".$row['notes']; ?></td>
<td><a href="<?php echo $_SERVER['PHP_SELF'];?>?op=d&id=<?php echo $row['idnumber'];?>">delete</a></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php
include("header.php");
require('db.php');
if (isset($_REQUEST['id']))
$id = $_REQUEST['id'];
$sql2 = "SELECT
company.id AS current,
(SELECT MIN(company.id) AS nextRecord FROM company WHERE company.id > '$currentrow') AS next,
(SELECT MAX(company.id) AS prevRecord FROM company WHERE company.id < '$currentrow') AS prev
FROM
company
WHERE
company.id = '$currentrow'";
$result2 = mysql_query($sql2) or die("Invalid query: " . mysql_error());
while ($row2 = mysql_fetch_assoc($result2))
{
?>
<table>
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Date</th>
<th scope="col">Name</th>
<th scope="col">Amount</th>
<th scope="col">Notes</th>
<th scope="col">Delete</th>
</tr>
</thead>
<tbody>
<?php
$query="SELECT idnumber, date, name, amount, notes FROM orders";
if("d"==strval($_REQUEST['op']) && is_numeric($_REQUEST['id']) )
{
$query="DELETE FROM `orders` WHERE `idnumber`=" . $_REQUEST['id'];
}
$result = mysql_query($query)
or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
?>
<tr>
<td><?php echo "".$row['idnumber']; ?></td>
<td><?php echo "".$row['date']; ?></td>
<td><?php echo "".$row['name']; ?></td>
<td><?php echo "".$row['amount']; ?></td>
<td><?php echo "".$row['notes']; ?></td>
<td><a href="<?php echo $_SERVER['PHP_SELF'];?>?op=d&id=<?php echo $row['idnumber'];?>">delete</a></td>
</tr>
<?php } ?>
</tbody>
</table>
include("footer.php");
}
?>
<?php
include("header.php");
require('db.php');
if( isset($_REQUEST['currentrow']) && is_numeric($_REQUEST['currentrow']) )
$currentrow=$_REQUEST['currentrow'];
if (isset($_REQUEST['id']) && is_numeric($_REQUEST['id']) )
$id = $_REQUEST['id'];
$sql2 = "SELECT
company.id AS current,
(SELECT MIN(company.id) AS nextRecord FROM company WHERE company.id > '$currentrow') AS next,
(SELECT MAX(company.id) AS prevRecord FROM company WHERE company.id < '$currentrow') AS prev
FROM
company
WHERE
company.id = '$currentrow'";
$result2 = mysql_query($sql2) or die("Invalid query: " . mysql_error());
while ($row2 = mysql_fetch_assoc($result2))
{
?>
<table>
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Date</th>
<th scope="col">Name</th>
<th scope="col">Amount</th>
<th scope="col">Notes</th>
<th scope="col">Delete</th>
</tr>
</thead>
<tbody>
<?php
$query="SELECT idnumber, date, name, amount, notes FROM orders";
if("d"==strval($_REQUEST['op']) && is_numeric($_REQUEST['id']) )
{
$query="DELETE FROM `orders` WHERE `idnumber`=" . $_REQUEST['id'];
}
$result = mysql_query($query)
or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
?>
<tr>
<td><?php echo "".$row['idnumber']; ?></td>
<td><?php echo "".$row['date']; ?></td>
<td><?php echo "".$row['name']; ?></td>
<td><?php echo "".$row['amount']; ?></td>
<td><?php echo "".$row['notes']; ?></td>
<td><a href="<?=$_SERVER['PHP_SELF']?>?op=d&id=<?=$row['idnumber']?>¤trow=<?=$currentrow?>">delete</a></td>
</tr>
<?php } ?>
</tbody>
</table>
include("footer.php");
}
?>
<?php
include("header.php");
require('db.php');
if( isset($_REQUEST['currentrow']) && is_numeric($_REQUEST['currentrow']) )
$currentrow=$_REQUEST['currentrow'];
if (isset($_REQUEST['id']) && is_numeric($_REQUEST['id']) )
$id = $_REQUEST['id'];
$sql2 = "SELECT
company.id AS current,
(SELECT MIN(company.id) AS nextRecord FROM company WHERE company.id > '$currentrow') AS next,
(SELECT MAX(company.id) AS prevRecord FROM company WHERE company.id < '$currentrow') AS prev
FROM
company
WHERE
company.id = '$currentrow'";
$result2 = mysql_query($sql2) or die("Invalid query: " . mysql_error());
while ($row2 = mysql_fetch_assoc($result2))
{
?>
<table>
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Date</th>
<th scope="col">Name</th>
<th scope="col">Amount</th>
<th scope="col">Notes</th>
<th scope="col">Delete</th>
</tr>
</thead>
<tbody>
<?php
if("d"==strval($_REQUEST['op']) && is_numeric($_REQUEST['id']) )
{
$query="DELETE FROM `orders` WHERE `idnumber`=" . $_REQUEST['id'];
mysql_query($query) or die(mysql_error());
}
$query="SELECT idnumber, date, name, amount, notes FROM orders";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
?>
<tr>
<td><?php echo "".$row['idnumber']; ?></td>
<td><?php echo "".$row['date']; ?></td>
<td><?php echo "".$row['name']; ?></td>
<td><?php echo "".$row['amount']; ?></td>
<td><?php echo "".$row['notes']; ?></td>
<td><a href="<?=$_SERVER['PHP_SELF']?>?op=d&id=<?=$row['idnumber']?>¤trow=<?=$currentrow?>">delete</a></td>
</tr>
<?php } ?>
</tbody>
</table>
include("footer.php");
}
?>
Experts Exchange Solution brought to you by
Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.
Start your 7-day free trialFrom novice to tech pro — start learning today.
Experts Exchange Solution brought to you by
Below is a fairly insecure way of doing it. You will have to trust your users quite a bit
Your delete link would look like this:
<td><a href="deleteme.php?deleter
Then... in deleteme.php,
require('db.php');
$result = mysql_query("DELETE FROM ORDERS WHERE idnumber =" . $_GET['deleterow'])
or die(mysql_error());