Okay. I'm not really sure what I'm trying to do have a name so I thought I'd get some input.
The search function works well in the format below but I want to add another column to enable a hyperlink to a page to perform edits for each row.
Now the problem: I want one of four pages to be automatically selected for a person to be sent to depending on the information found in the "TYPE" field.
I've tried to use an if elseif setup but I keep getting T_STRING errors.
If anyone has got any suggestion this would be appreciated. If someone have a better script to offer that would be appreciated also.
<?
if ($search) // perform search only if a string was entered.
if ($search2) // perform search only if a string was entered.
{
$server = "localhost";
$db_user = "smith";
$db_pass = "";
$database = "water";
mysql_connect("$server", "$db_user", "$db_pass") or die ("Problem connecting to DataBase");
$query = "select * from List WHERE username='$search' AND password='$search2' ORDER BY id DESC";
$result = mysql_db_query("$database", $query);
if ($result)
{
echo "<br>";
echo "<table width=80% align=center border=1><tr>
<td align=center bgcolor=#00FFFF><b>Card/Tag Number:</b></td>
<td align=center bgcolor=#00FFFF><b>Holder's Name:</b></td>
<td align=center bgcolor=#00FFFF><b>Type of Card / Tag:</b></td>
</tr>Click here when: <a href=admin.php>Finished Viewing.</a><br><br>";
while ($r = mysql_fetch_array($result)) { // Begin while
$ts = $r["Username"];
$id =$r["id"];
$Email =$r["Email"];
$FirstName =$r["FirstName"];
$MiddleName =$r["MiddleName"];
$LastName =$r["LastName"];
$Type =$r["Type"];
echo "<tr>
<tr>
<td><center>$id</td>
<td><center>$FirstName $MiddleName $LastName</td>
<td><center>$Type</td>
<tr><td colspan=5 bgcolor=\"#FFFFFF\"><font color=\"#FFFFFF\"></font></tr></td>
<tr><td colspan=5 bgcolor=\"#ffaa00\"><font color=\"#ffaa00\">.</font></td>
</tr>";
} // end while
echo "</table>";
} else { echo "problems...."; }
} else { echo "Invalid search. <br> Please go back and type in your email address.";
}
?>