Jump to content

Delete data from database PHP


adap

Recommended Posts

<?php

$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="sk39_properties"; // Database name
$tbl_name="properties"; // Table name

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

// select record from mysql
$sql="SELECT * FROM properties";
$result=mysql_query($sql);

?>
<table width="400" border="0" cellspacing="1" cellpadding="0">
<tr>
<td><table width="400%" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#FFFFFF"> </td>
<td colspan="4" bgcolor="#FFFFFF"><strong>Delete data in mysql</strong> </td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><strong>Id</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Unit Number</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Land Title</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Tenure</strong></td>
<td align="center" bgcolor="#FFFFFF"> </td>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td bgcolor="#FFFFFF"><? echo $rows['id']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['UnitNumber']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['LandTitle']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['Tenure']; ?></td>
<td bgcolor="#FFFFFF"><a href="delete_ac.php?id=<? echo $rows['id']; ?>">delete</a></td>
</tr>
<?

// close while loop
}

// close connection;
mysql_close();

?>
</table></td>
</tr>
</table>

Above is my code. And when i try to run it, it states that i got parse error at line 53. Anyone can help? Thanks. Truly appreciate it.

 

Link to comment
https://forums.phpfreaks.com/topic/190729-delete-data-from-database-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.