<?php
if(isset($_POST['Search']))
{
//Database connection
$num = $_POST['num'];
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error
connecting to mysql');
$dbname = 'vasuki';
mysql_select_db($dbname);
$Result = mysql_query("SELECT id, name, age FROM details WHERE id =
'$num'");
while($row = mysql_fetch_array($Result))
{
$name = $row['name'] ;
$age = $row['age'];
//Creating table
echo "<div style='top: 273px;
margin-left: 60px;
position: absolute;left: 30px;'>
<table border='1'><tr><th>name</th>
<th> age </th></tr>
//Connect to Database to fetch the data
<td>echo'<?php $name ?>;'</td>
<td>echo'<?php $age ?>;'</td>
</table></div>";
}
I have a data in my xampp database.
In front end using php I need to search the data and find the data from database.
I just pasted only php code here.I hope I did some mistake in above the code.
I have a doubt on this below code :
<td>echo'<?php $name ?>;'</td>
Is this a corrct syntax?.
Because I am getting error in above the line.
I am using it inside echo cmd so I have a doubt. Kindly clarify