adap Posted February 3, 2010 Share Posted February 3, 2010 <?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 More sharing options...
gizmola Posted February 3, 2010 Share Posted February 3, 2010 Probably because you tried to use a short tag here: delete Change the to <?php Link to comment https://forums.phpfreaks.com/topic/190729-delete-data-from-database-php/#findComment-1005828 Share on other sites More sharing options...
adap Posted February 3, 2010 Author Share Posted February 3, 2010 Thanks for the guidance. But once i change it. I only able to display table without data. Any solution? Link to comment https://forums.phpfreaks.com/topic/190729-delete-data-from-database-php/#findComment-1005847 Share on other sites More sharing options...
gizmola Posted February 3, 2010 Share Posted February 3, 2010 If you have short tags off in the php.ini you can't use short tags -- so anyplace you used you need <?php. Link to comment https://forums.phpfreaks.com/topic/190729-delete-data-from-database-php/#findComment-1006350 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.