I have put together a page to run a search on my db. It is still in its early stages but I'm getting a weird error on the </html> tag on the page. The error is "Parse error: parse error, unexpected '>' in /home/oddyseys/public_html/function_lib.php on line 158." This error is keeping me from seeing what else may be wrong. I will post the code for this page and the functions it calls. I'd very much appreciate someone checking over my code to make sure I am heading in the right direction.
Thanks in advance.
Jim
connect2.php code:
<html>
<head>
<title>Our Contacts</title>
<style type="text/css">
body
{
background-color: #3366CC;
}
a:link
{
color: #000000;
}
a:visited
{
color: #00FF00;
}
a:hover
{
color: #0000FF;
}
a:active
{
color: #0033FF;
}
</style>
</head>
<body>
<?
//call in library holding all my functions
include 'function_lib.php';
//Connect to the server
$dbh=mysql_connect ("localhost", "username here", "password here")
or die ('I cannot connect to the database because: ' . mysql_error());
//Select the db I want to use
mysql_select_db ("database name here");
$TrName = $HTTP_GET_VARS["TName"];
$TrArea = $HTTP_GET_VARS["TArea"];
$SkName = $HTTP_GET_VARS["SName"];
?>
<table width="100%" border="1">
<tr>
<td rowspan="3">Links Panel</td>
<td>Trainer Name:</td>
<td><input type="text" name="TName" maxlength="30"></td>
<td><form action = "SearchTrainerName($TrName);" method="get"><input type="button" value="Search Trainer Names"></form></td>
</tr>
<tr>
<td>Trainer Area:</td>
<td><input type="text" name="TArea" maxlength="30"></td>
<td><form action = "SearchTrainerArea($TrArea);" method="get"><input type="button" value="Search Trainer Areas"></form></td>
</tr>
<tr>
<td>Skill Name:</td>
<td><input type="text" name="SName" maxlength="30"></td>
<td><form action = "SearchSkillName($SkName);" method="get"><input type="button" value="Search For Skills"></form></td>
</tr>
</table>
</body>
</html>
function_lib.php code:
<?
function SearchTrainerName($TrName)
{
$TrNameResults = mysql_query("select from Trainers where TrName = \"$TrName\"
/
and (
(TrSk1 is not null) or
(TrSk2 is not null) or
(TrSk3 is not null) or
(TrSk4 is not null) or
(TrSk5 is not null) or
(TrSk6 is not null) or
(TrSk7 is not null) or
(TrSk8 is not null) or
(TrSk9 is not null) or
(TrSk10 is not null) or
(TrSk11 is not null) or
(TrSk12 is not null) or
(TrSk13 is not null) or
(TrSk14 is not null) or
(TrSk15 is not null) or
(TrSk16 is not null) or
(TrSk17 is not null) or
(TrSk18 is not null) or
(TrSk19 is not null) or
(TrSk20 is not null)
)*/");
echo("<hr>");
function SearchTrainerArea($TrArea)
{
$TrAreaResults = mysql_query("select from Trainers where TrArea = \"$TrArea\"
/
and (
(TrSk1 is not null) or
(TrSk2 is not null) or
(TrSk3 is not null) or
(TrSk4 is not null) or
(TrSk5 is not null) or
(TrSk6 is not null) or
(TrSk7 is not null) or
(TrSk8 is not null) or
(TrSk9 is not null) or
(TrSk10 is not null) or
(TrSk11 is not null) or
(TrSk12 is not null) or
(TrSk13 is not null) or
(TrSk14 is not null) or
(TrSk15 is not null) or
(TrSk16 is not null) or
(TrSk17 is not null) or
(TrSk18 is not null) or
(TrSk19 is not null) or
(TrSk20 is not null)
)*/");
echo("<hr>");
DisplayTRAreaResults($TrAreaResults);
}
function SearchSkillName($SkName)
{
$TrSkillResults = mysql_query("select from Trainers where \"$SkName\"
/
and (
(TrSk1 is not null) or
(TrSk2 is not null) or
(TrSk3 is not null) or
(TrSk4 is not null) or
(TrSk5 is not null) or
(TrSk6 is not null) or
(TrSk7 is not null) or
(TrSk8 is not null) or
(TrSk9 is not null) or
(TrSk10 is not null) or
(TrSk11 is not null) or
(TrSk12 is not null) or
(TrSk13 is not null) or
(TrSk14 is not null) or
(TrSk15 is not null) or
(TrSk16 is not null) or
(TrSk17 is not null) or
(TrSk18 is not null) or
(TrSk19 is not null) or
(TrSk20 is not null)
)*/");
echo("<hr>");
}
function DisplayTRAreaResults($TrAreaResults)
{
//$rowsFound = mysql_num_rows($TrAreaResults);
echo("<table>");
echo("<tr>");
echo("<th>TrainerID</th>");
echo("<th>Trainer Name</th>");
echo("<th>Directions to Trainer</th>");
echo("<th>Trainer Area</th>");
echo("<th>Trainer Skill 1</th>");
echo("<th>Trainer Skill 2</th>");
echo("<th>Trainer Skill 3</th>");
echo("<th>Trainer Skill 4</th>");
echo("<th>Trainer Skill 5</th>");
echo("<th>Trainer Skill 6</th>");
echo("<th>Trainer Skill 7</th>");
echo("<th>Trainer Skill 8</th>");
echo("<th>Trainer Skill 9</th>");
echo("<th>Trainer Skill 10</th>");
echo("<th>Trainer Skill 11</th>");
echo("<th>Trainer Skill 12</th>");
echo("<th>Trainer Skill 13</th>");
echo("<th>Trainer Skill 14</th>");
echo("<th>Trainer Skill 15</th>");
echo("<th>Trainer Skill 16</th>");
echo("<th>Trainer Skill 17</th>");
echo("<th>Trainer Skill 18</th>");
echo("<th>Trainer Skill 19</th>");
echo("<th>Trainer Skill 20</th>");
echo("</tr>");
while( $row = mysql_fetch_array($TrAreaResults) )
{
echo("td" . $row[TrID] . "</td>");
echo("td" . $row[TrName] . "</td>");
echo("td" . $row[TrDir] . "</td>");
echo("td" . $row[TrArea] . "</td>");
echo("td" . $row[TrSk1] . "</td>");
echo("td" . $row[TrSk2] . "</td>");
echo("td" . $row[TrSk3] . "</td>");
echo("td" . $row[TrSk4] . "</td>");
echo("td" . $row[TrSk5] . "</td>");
echo("td" . $row[TrSk6] . "</td>");
echo("td" . $row[TrSk7] . "</td>");
echo("td" . $row[Trsk7] . "</td>");
echo("td" . $row[TrSk8] . "</td>");
echo("td" . $row[TrSk9] . "</td>");
echo("td" . $row[TrSk10] . "</td>");
echo("td" . $row[TrSk11] . "</td>");
echo("td" . $row[TrSk12] . "</td>");
echo("td" . $row[TrSk13] . "</td>");
echo("td" . $row[TrSk14] . "</td>");
echo("td" . $row[TrSk15] . "</td>");
echo("td" . $row[TrSk16] . "</td>");
echo("td" . $row[TrSk17] . "</td>");
echo("td" . $row[TrSk18] . "</td>");
echo("td" . $row[TrSk19] . "</td>");
echo("td" . $row[TrSk20] . "</td>");
echo("</tr>");
}
echo("</table>);
echo("</body>");
echo("</html");
//echo("<p>$rowsFound records match your criteria</p>");
}
Anymore questions email me or post them here and I will answer promptly.