wantabe2
asked on
Edit MySQL Data from Browser with PHP
Is it possible for me to edit mysql data from a browser with php? In the attached code, it will display the data from the mysql database in a browser. Notice line:
echo '<td><a href="edit_g.php"><center> EDIT</cent er></a></t d>';
If I have a file named edit_g.php, could I add some type of code to it so I could edit the mysql data for that particular record?
echo '<td><a href="edit_g.php"><center>
If I have a file named edit_g.php, could I add some type of code to it so I could edit the mysql data for that particular record?
<p> To go back <a href="http://mysite/flow/index.html">click here</a>.</p>
<?php
$con = mysql_connect("localhost","uname","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("psrflow", $con);
$result = mysql_query("SELECT * FROM orderinfo WHERE status = 'office a'");
echo "<table border='7'>
<tr>
<th>Cust No</th>
<th>First Name</th>
<th>Last Name</th>
<th>Status</th>
<th></th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td align='center'>" . $row['custno'] . "</td>";
echo "<td align='center'>" . $row['fname'] . "</td>";
echo "<td align='center'>" . $row['lname'] . "</td>";
echo "<td align='center'>" . $row['status'] . "</td>";
echo '<td><a href="edit_g.php"><center>EDIT</center></a></td>';
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.