how can i add edit to this code i want to to be albe to edit the databse as this page only view my database <?php require ("dbconnection.inc.php"); connect(); $search = $_POST["search"];$result = mysql_query("SELECT * FROM Businesses WHERE BusinessID LIKE '%$search%' OR CompanyName LIKE '%$search%' OR TradingName LIKE '%$search%' OR BusinessTypeID LIKE '%$search%' OR NumberOfSites LIKE '%$search%'OR NumberofEmployees LIKE '%$search%'OR CompanyVATNumber LIKE '%$search%'OR CompanyRegistrationNumber LIKE '%$search%'OR RegisteredAddressID LIKE '%$search%'OR YearEstablished LIKE '%$search%' OR NatureOfBusiness LIKE '%$search%'"); echo "<table width=700 border=1>"; echo "<tr bgcolor=ffffff align=middle font-size=50> <th>BusinessID</th> <th>CompanyName</th> <th>TradingName</th> <th>BusinessTypeID</th> <th>NumberOfSites</th> <th>NumberofEmployees</th> <th>CompanyVATNumber</th> <th>CompanyRegistrationNumber</th> <th>RegisteredAddressID</th> <th>YearEstablished</th> <th>NatureOfBusiness</th> </tr>"; while($row=mysql_fetch_array($result)) { $BusinessID=$row["BusinessID"]; $CompanyName=$row["CompanyName"]; $TradingName=$row["TradingName"]; $BusinessTypeID=$row["BusinessTypeID"]; $NumberOfSites=$row["NumberOfSites"]; $NumberofEmployees=$row["NumberofEmployees"]; $CompanyVATNumber=$row["CompanyVATNumber"]; $CompanyRegistrationNumber=$row["CompanyRegistrationNumber"]; $RegisteredAddressID=$row["RegisteredAddressID"]; $YearEstablished=$row["YearEstablished"]; $NatureOfBusiness=$row["NatureOfBusiness"]; echo "<tr><td><a href='example.php?BusinessID=$BusinessID'>$BusinessID</a></td><td>" . $CompanyName . "</td><td>" . $TradingName . "</td><td>" . $BusinessTypeID . "</td><td>" . $NumberOfSites . "</td><td>" . $NumberofEmployees . "</td><td>" . $CompanyVATNumber . "</td><td>" . $CompanyRegistrationNumber . "</td><td>" . $RegisteredAddressID . "</td><td>" . $YearEstablished . "</td><td>" . $NatureOfBusiness . "</td></tr>" ; }echo "</table>";?> </p><p> </p></body></html>
These are the basics. The steps would be: 1. Query the table as you do and make it appear in a form with editable fields by simply using the right HTML tags around the values. or you can simply put an edit link at the end of each row and generate the editable form on next page. 2. When the user post the edited value, read it and update the database. This can be same or another php page. You may have to send the ID or somethign as a hidden field. You can actually refer some simple tutorail, there are tons of them available on net.
Dear Sarakh Sir, Thank you very much for your prompt resppnse. Now with code you have forward, I can display the records,. Since I am beginner, I cannot add mode codes for invoking the eaditable field. Could you please send me code for that too. Thank you