I'm trying to make a page to filter invoices via company and status, but it doesnt seem to work for me. Right now, I have 3 companies and 3 statuses in the database, and right now none of the filters do anything it seems. Plus I have :
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\Apache Group\Apache2\htdocs\php\b\invoicelist.php on line 68
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\Apache Group\Apache2\htdocs\php\b\invoicelist.php on line 70
Popping up everywhere. Here's my php script, it goes invoice.php(search critera page) -> invoicelist.php(results page)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Manage Invoices</title>
<meta http-equiv="content-type"
content="text/html; charset=iso-8859-1" />
</head>
<body>
<h1>Manage Invoices</h1>
<p><a href="newinvoice.php">Create New Invoice</a></p>
<?php
$dbcnx = @mysql_connect('127.0.0.1:3306', 'root', '');
if (!$dbcnx) {
exit('<p>Unable to connect to the ' .
'database server at this time.</p>');
}
if (!@mysql_select_db('invoice')) {
exit('<p>Unable to locate the invoice' .
'database at this time.</p>');
}
$authors = @mysql_query('SELECT id, name FROM company');
if (!$authors) {
exit('<p>Unable to obtain company list from the database.</p>');
}
$cats = @mysql_query('SELECT id, name FROM status');
if (!$cats) {
exit('<p>Unable to obtain status list from the database.</p>');
}
?>
<form action="invoicelist.php" method="post">
<p>View Invoices satisfying the following criteria:</p>
<label>By Company:
<select name="aid" size="1">
<option selected value="">Any Company</option>
<?php
while ($author = mysql_fetch_array($authors)) {
$aid = $author['id'];
$aname = htmlspecialchars($author['name']);
echo "<option value='$aid'>$aname</option>\n";
}
?>
</select></label><br />
<label>By Status:
<select name="cid" size="1">
<option selected value="">Any Status</option>
<?php
while ($cat = mysql_fetch_array($cats)) {
$cid = $cat['id'];
$cname = htmlspecialchars($cat['name']);
echo "<option value='$cid'>$cname</option>\n";
}
?>
</select></label><br />
<input type="submit" value="Search" />
</form>
<p><a href="index.html">Return to front page</a></p>
</body>
</html>