php parse error
error at end of prog.unexpected $:(
!doctype html public "-//W3C//DTD HTML 4.0//EN">
<?php
error_reporting (E_ALL);
$flag=true;
$link=mysql_connect("localhost", "ajit", "ajit")
or die ("Could not connect to MySQL");
mysql_select_db ("ajit")
or die ("Could not select database");
$submitSearch=$_POST['submit'];
$name=$_POST['search'];
$add=$_POST['add'];
if(isset($link))
{ if(isset($submitSearch))
{
if(isset($name))
{
$searchResult=mysql_query('select * from personInfo where name LIKE `"$name" ORDER BY date DESC;')
or die ("Query failed");
if(mysql_num_rows($searchResult)>0 ){
display_table($searchResult);
}
else{
echo"no such row obtained";
}
}
else{echo"Give the name of person you want to search";}
}
elseif(isset($add))
{
Header("Location: http://.../~ajit/infoform.php");
}
else{
$result = mysql_query('select * from personInfo order BY date DESC;')
or die ("Query failed");
$num=mysql_num_rows($result);
display_table($result);
}
}
else{
echo"could not connect to the database";
}
/* THIS TABLE WILL DISPLAY ALL FETCHED ROWS FROM TABLE + ADD EDIT LINK+
+E-MAIL LINK*/
function display_table($result)
{
if(isset($result))
{
$subject="REMINDER ABOUT WORK";
$messege="Hello sir/madam";
print "<table border=1><br>";
$temp=0;
echo"<tr>";
for($temp=0;$temp<18;$temp++)
{
echo"<td>";
$fieldname= mysql_field_name($result, $temp);
echo"$fieldname";
echo"</td>";
}
echo"</tr>";
while ($line = mysql_fetch_array($result))
{
echo "<tr>";
foreach ($line as $key=>$value)
{
$temp=0;
if ((mysql_field_name($result, $temp)=="emailid"))
{
echo "<td>";
@mail($value, $subject, $message );
//echo'<a href="mailto:$value?subject="Feedback">E-MAIL</a>';
echo "</td>";
}
else{
echo "<td>";
echo"$value";
echo"</td>";
}
`
$row = mysql_fetch_array($result,MYSQL_NUM);
$id=$row[0];
//echo"<td align=\"center\" bgcolor=\"#5647A1\" onclick=\"window.location.href='editform.php';\"> EDIT </td>";
echo"<td>";
echo"<a href=\"editinfo.php?Name=id\">";
echo"</td>";
$temp++;
echo "</tr>";
}
print "</table><br>";
}
}
else{
echo"NO RESULTS FOUND";
}
}
?>
<html>
<head>
<title>PERSON INFORMATION</title>
</head>
<body>
<form method="post" >
<input type="text" name="search" <br>
<label> SEARCH PERSON NAME</label>
<input type="submit" name="submit" value="SEARCH PEOPLE">
<input type="submit" name="add" value="ADD_NEW_RECORD">
</form>
</body>
</html>
|