The following is my getdata.php
script which isn't working:
<?php
$host="localhost";
$username="root";
$password="demo";
$db_name="test";
$tbl_name="test";
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="SELECT * FROM $tbl_name";
$result=mysql_query($sql);
?>
<?php
while($rows=mysql_fetch_array($result)){
<table width="400" border="1" cellspacing="0" cellpadding="3">
<tr>
<td width="10%"><? echo $rows['id']; ?></td>
<td width="30%"><? echo $rows['name']; ?></td>
<td width="30%"><? echo $rows['lastname']; ?></td>
<td width="30%"><? echo $rows['email']; ?></td>
</tr>
</table>
}
?>
<?php
mysql_close();
?>
I’m using xampp server 1.8 with Windows XP sp2; I don't know which php version, but when I run this script it shows error '<' unexpected ~~~~~~~
Some error total thing is that this php is not executing tables and for per entry. What's wrong in my script?