Newbie here to PHP
I have MYSQL db with a table called categories.
I built the form to insert the data into the db - that works great
Data is inserted fine.
Fields are: projcategoryid, section, category, rank
2 Fields: ID and RANK show - other 2 get error
Output Data page:
I want to show the list of items in the table sorted by a rank or section no.
Here is error:
Notice: Undefined index: Section in C:\wamp\www\test\categories.php on line 70
Notice: Undefined index: Category in C:\wamp\www\test\categories.php on line 71
Here is code:
<?php
$con = mysql_connect("localhost","root");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("testphp", $con);
$result = mysql_query("SELECT * FROM categories ORDER BY section");
echo "<table border='1'>
<tr>
<th>ID</th>
<th>Section</th>
<th>Category</th>
<th>Rank</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['projcategoryid'] . "</td>";
echo "<td>" . $row['Section'] . "</td>";
echo "<td>" . $row['Category'] . "</td>";
echo "<td>" . $row['rank'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
If I don't have the HTML table formatting:
I can get the output to work.
Many thanks in advance for your kind help.
Terry