FireGeek21
Technical User
I am new to php and am working on a web page of employee pictures. I would like to protect our employee information so would like to retrieve data based on a specific number from a mysql database. I would like to return only a single field (Position) based on a value in HTML code. Here is some php code I wrote that returns all the data from my database and puts it into a table on my website. This php works. Looking to see how I can modify it because I want only the Position returned based on a Nbr in HTML. Below is an HTML sample.
Here is a sample of HTML I am working with that retrieves the employee picture. Each employee picture is stored according to a number. This number correlates to the Nbr field in the mysql database. The bottom section (Position) is what I want pulled in from the mysql database. It will be easier to update the mysql database than the HTML code.
Looking for ideas. THANK YOU!!!
FireGeek
(currently using Crystal Reports XI with Lawson 9.01)
PHP:
<?php
$con = mysql_connect(localhost,userid,password);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db(database, $con);
$result = mysql_query("SELECT * FROM email_address ORDER BY Nbr");
echo "<table border='1'>
<tr>
<th>Nbr</th>
<th>LName</th>
<th>FName</th>
<th>Email</th>
<th>Position</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['Nbr'] . "</td>";
echo "<td>" . $row['LName'] . "</td>";
echo "<td>" . $row['FName'] . "</td>";
echo "<td>" . $row['Email'] . "</td>";
echo "<td>" . $row['Position'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
Here is a sample of HTML I am working with that retrieves the employee picture. Each employee picture is stored according to a number. This number correlates to the Nbr field in the mysql database. The bottom section (Position) is what I want pulled in from the mysql database. It will be easier to update the mysql database than the HTML code.
HTML:
<tr>
<td align="center"><img class="normal" src="\includes\mfd_nbrs\64.png" /><td>
<td align="center"><img class="normal" src="\includes\mfd_nbrs\25.png" /><td>
<td align="center"><img class="normal" src="\includes\mfd_nbrs\7.png" /><td>
<td align="center"><img class="normal" src="\includes\mfd_nbrs\37.png" /><td>
</tr>
<tr>
<td align="center">FT Firefighter/Paramedic<td>
<td align="center">Firefighter/Paramedic<td>
<td align="center">Firefighter/Paramedic<td>
<td align="center">FT Firefighter/Paramedic<td>
</tr>
Looking for ideas. THANK YOU!!!
FireGeek
(currently using Crystal Reports XI with Lawson 9.01)