Я пытался вывести результат через .$result['name'].
, но бесполезно.Невозможно отобразить данные из базы данных в таблице
Ниже мой код:
<?php
mysql_connect("localhost", "root", "") or die("Error connecting to database: ".mysql_error());
mysql_select_db("amityada_admission") or die(mysql_error());
?>
<!DOCTYPE html>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<title>Search Inquiry</title>
</head>
<body>
<div class="container">
<h3>Search Result</h3>
<p>
<?php
$query = $_POST['query'];
$min_length = 5;
if(strlen($query) >= $min_length){
$query = htmlspecialchars($query);
$query = mysql_real_escape_string($query);
$raw_results = mysql_query("SELECT * FROM student_admission
WHERE (`mobile` LIKE '%".$query."%') OR (`name` LIKE '%".$query."%') OR (`university` LIKE '%".$query."%')") or die(mysql_error());
if(mysql_num_rows($raw_results) > 0){
echo "<table>";
while ($results = mysql_fetch_assoc($raw_results)) {
echo <<<EOD
<h2 style="background-color:#009; color:#FFF; padding: 10px; alignment-adjust:baseline">Student Admission Form</h2>
<div align="center">
<table width="90%" border="1">
<tr>
<th colspan="4" scope="row"><h3 align="left" style="background-color:#F39; color:#FFF; padding: 10px">Admission Form for | $name | Session 2015-2016</h3></th>
<td colspan="2" rowspan="7">$file</td>
</tr>
<tr>
<th colspan="4" scope="row" style="background-color:#009; color:#FFF; padding:4px; font-family:Georgia, 'Times New Roman', Times, serif" ><div align="left"><strong>Personal Details</strong></div></th>
</tr>
<tr>
<th width="29%" scope="row"><div align="left">Student Name</div></th>
<td width="9%"><div align="left">$name</div></td>
<td width="25%"><div align="left"><strong>Fathers Name</strong></div></td>
<td width="13%"><div align="left">$fname</div></td>
</tr>
<tr>
<th scope="row"><div align="left">Mothers Name</div></th>
<td><div align="left">$mname</div></td>
<td><div align="left"><strong>Date of Birth</strong></div></td>
<td><div align="left">$dob</div></td>
</tr>
<tr>
<th scope="row"><div align="left">Mobile Number</div></th>
<td><div align="left">$mobile</div></td>
<td><div align="left"><strong>Email ID</strong></div></td>
<td><div align="left">$email</div></td>
</tr>
<tr>
<th scope="row"><div align="left">Gender</div></th>
<td><div align="left">$gender</div></td>
<td><div align="left"><strong>Marital Status</strong></div></td>
<td><div align="left">$maritalstatus</div></td>
</tr>
<tr>
<th scope="row"><div align="left">Employed</div></th>
<td><div align="left">$employed</div></td>
<td><div align="left"><strong>Course Type</strong></div></td>
<td><div align="left">$coursetype</div></td>
</tr>
<tr>
<th colspan="6" scope="row" style="background-color:#009; color:#FFF; padding:4px; font-family:Georgia, 'Times New Roman', Times, serif"><div align="left">Educational Details</div></th>
</tr>
<tr>
<th scope="row"><div align="left"><strong>Current Education</strong></div></th>
<td><div align="left">$current_educational_details</div></td>
<td><div align="left"><strong>Course Applied For</strong></div></td>
<td><div align="left">$course</div></td>
<td width="11%"><div align="left"><strong>Specialization</strong></div></td>
<td width="13%"><div align="left">$specialization</div></td>
</tr>
<tr>
<th scope="row"><div align="left">Lateral Entry</div></th>
<td><div align="left">$lateralentry</div></td>
<td><div align="left"><strong>Lateral Entry In</strong></div></td>
<td><div align="left">$lateral_entry_in</div></td>
<td><div align="left"></div></td>
<td><div align="left"></div></td>
</tr>
<tr>
<th colspan="6" scope="row" style="background-color:#009; color:#FFF; padding:4px; font-family:Georgia, 'Times New Roman', Times, serif"><div align="left">Correspondence Address</div> <div align="left"></div> <div align="left"></div> <div align="left"></div> <div align="left"></div> <div align="left"></div></th>
</tr>
<tr>
<th scope="row"><div align="left">Address</div></th>
<td colspan="5"><div align="left">$corr_add</div> <div align="left"></div> <div align="left"></div> <div align="left"></div> <div align="left"></div></td>
</tr>
<tr>
<th scope="row"><div align="left">Country</div></th>
<td><div align="left">$countryId</div></td>
<td><div align="left"><strong>State</strong></div></td>
<td><div align="left">$stateId</div></td>
<td><div align="left"><strong>City</strong></div></td>
<td><div align="left">$cityId</div></td>
</tr>
<tr>
<th colspan="6" scope="row" style="background-color:#009; color:#FFF; padding:4px; font-family:Georgia, 'Times New Roman', Times, serif"><div align="left">Payment Option</div> <div align="left"></div> <div align="left"></div> <div align="left"></div> <div align="left"></div> <div align="left"></div></th>
</tr>
<tr>
<th scope="row"><div align="left">Payment Mode</div></th>
<td><div align="left">$payment_method</div></td>
<td><div align="left"><strong>Payment Option</strong></div></td>
<td><div align="left">$feesinfull</div></td>
<td><div align="left"></div></td>
<td><div align="left"></div></td>
</tr>
<tr>
<th scope="row"><div align="left">Complete Fees</div></th>
<td><div align="left">$coursefees</div></td>
<td><div align="left"><strong>Full Fees Paid</strong></div></td>
<td><div align="left">$fullfees</div></td>
<td><div align="left"><strong>Discount</strong></div></td>
<td><div align="left">$discount</div></td>
</tr>
<tr>
<th colspan="6" scope="row" style="background-color:#009; color:#FFF; padding:4px; font-family:Georgia, 'Times New Roman', Times, serif"><div align="left">Installment Options</div> <div align="left"></div> <div align="left"></div> <div align="left"></div> <div align="left"></div> <div align="left"></div></th>
</tr>
<tr>
<th scope="row"><div align="left">Installment 1</div></th>
<td><div align="left">$installment1</div></td>
<td><div align="left"><strong>Paid On</strong></div></td>
<td><div align="left">$ins1</div></td>
<td><div align="left"></div></td>
<td><div align="left"></div></td>
</tr>
<tr>
<th scope="row"><div align="left">Installment 2</div></th>
<td><div align="left">$installment2</div></td>
<td><div align="left"><strong>Paid On</strong></div></td>
<td><div align="left">$ins2</div></td>
<td><div align="left"></div></td>
<td><div align="left"></div></td>
</tr>
<tr>
<th scope="row"><div align="left">Installment 3</div></th>
<td><div align="left">$installment3</div></td>
<td><div align="left"><strong>Paid On</strong></div></td>
<td><div align="left">$ins3</div></td>
<td><div align="left"></div></td>
<td><div align="left"></div></td>
</tr>
<tr>
<th scope="row"><div align="left">Installment 4</div></th>
<td><div align="left">$installment4</div></td>
<td><div align="left"><strong>Paid On</strong></div></td>
<td><div align="left">$ins4</div></td>
<td><div align="left"></div></td>
<td><div align="left"></div></td>
</tr>
<tr>
<th scope="row"><div align="left">Installment 5</div></th>
<th scope="row"><div align="left">$installment5</div></th>
<th scope="row"><div align="left"><strong>Paid On</strong></div></th>
<th scope="row"><div align="left">$ins5</div></th>
<th scope="row"><div align="left"></div></th>
<th scope="row"><div align="left"></div></th>
</tr>
<tr>
<th scope="row"><div align="left">Installment 6</div></th>
<th scope="row"><div align="left">$installment6</div></th>
<th scope="row"><div align="left"><strong>Paid On</strong></div></th>
<th scope="row"><div align="left">$ins6</div></th>
<th scope="row"><div align="left"></div></th>
<th scope="row"><div align="left"></div></th>
</tr>
<tr>
<th scope="row"><div align="left">Installment 7</div></th>
<th scope="row"><div align="left">$installment7</div></th>
<th scope="row"><div align="left"><strong>Paid On</strong></div></th>
<th scope="row"><div align="left">$ins7</div></th>
<th scope="row"><div align="left"></div></th>
<th scope="row"><div align="left"></div></th>
</tr>
<tr>
<th scope="row"><div align="left">Installment 8</div></th>
<th scope="row"><div align="left">$installment8</div></th>
<th scope="row"><div align="left"><strong>Paid On</strong></div></th>
<th scope="row"><div align="left">$ins8</div></th>
<th scope="row"><div align="left"></div></th>
<th scope="row"><div align="left"></div></th>
</tr>
<tr>
<th scope="row"><div align="left">Installment 9</div></th>
<th scope="row"><div align="left">$installment9</div></th>
<th scope="row"><div align="left"><strong>Paid On</strong></div></th>
<th scope="row"><div align="left">$ins9</div></th>
<th scope="row"><div align="left"></div></th>
<th scope="row"><div align="left"></div></th>
</tr>
<tr>
<th scope="row"><div align="left">Installment 10</div></th>
<th scope="row"><div align="left">$installment10</div></th>
<th scope="row"><div align="left"><strong>Paid On</strong></div></th>
<th scope="row"><div align="left">$installment10</div></th>
<th scope="row"><div align="left"></div></th>
<th scope="row"><div align="left"></div></th>
</tr>
<tr>
<th colspan="6" scope="row"><div align="left">
<p>This is Just an Admission Form filled for the purpose of Applying for the University. This is not an University Admission Form and Should only be traeted for Pune Institute Admission Purpose. Any Changes or Request for Updation of Student Details of Change of University has to be Submitted to the IT Admin through mail on <strong>[email protected]</strong></p>
</div></th>
</tr>
<tr>
<th colspan="6" scope="row" style="background-color:grey; color:white; padding: 7px">© <a href="#">Ankit</a> 2003-2015 | Powered By © <a href="#">Diaphram</a> 2011-2015 </th>
</tr>
</table>
</div>
EOD;
}
echo "</table>";
}
else{
echo "No Results Found";
}
}
else{
echo "Oops !! You Pressed Refresh Button or Minimum Input Value is $min_length";
}
?>
</table>
</body>
</html>
это должно быть '$ results ['name']' – madforstrength
что здесь ошибка? Пожалуйста, покажи нам. – Makudex
синтаксическая ошибка, неожиданная '' (T_ENCAPSED_AND_WHITESPACE), ожидающая идентификатор (T_STRING) или переменная (T_VARIABLE) или номер (T_NUM_STRING) в /home/amityadav/public_html/admissionform/result.php в строке 48 –