Ijas Hameem

Ijas Hameem

  • NA
  • 25
  • 6.9k

want to fix My SQL query Error

Jun 17 2017 12:59 AM
Fatal error: Uncaught Error: Call to undefined function mysql_query() in C:\xampp\htdocs\test\search.php:20 Stack trace: #0 {main} thrown in C:\xampp\htdocs\test\search.php on line 20
i am using php7.1 version is there issue?
 
http://www.c-sharpcorner.com/uploadfile/c63ec5/display-records-in-html-textboxes-in-php-script/ i use your code and create the database that code shown. 
 
i paste code here it's search.php
 
 
 
<?php
$con=mysqli_connect("localhost","root","","test");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// ...some PHP code for database "my_db"...
// Change database to "test"
mysqli_select_db($con,"test");
// ...some PHP code for database "test"...
//$sql="select * from accountdtl";
$result = mysql_query("select * from accountdtl where account_no='$_POST[name]'");
while($rowval = mysql_fetch_array($result))
{
$accountnumber= $rowval['account_no'];
$title= $rowval['title'];
$fname= $rowval['fname'];
$lname= $rowval['lname'];
$add1= $rowval['address1'];
$add2= $rowval['address2'];
$town= $rowval['town'];
$country= $rowval['country'];
$pin= $rowval['pcode'];
$mob= $rowval['con_no'];
$mailid= $rowval['mail_id'];
$uname= $rowval['uname'];
$balance= $rowval['balance'];
}
mysql_close($con);
?>
<html>
<body>
<from >
<table style="color:purple;border-style:groove; height:150px;width:350px" background="3.jpg">
<tr>
<td style="font-family:Copperplate Gothic Bold">&nbsp;</td>
</tr>
<tr>
<td style="color:red;background-color:aqua;" class="auto-style3">Account no:</td>
<td class="auto-style4">
<input id="Text1" type="text" value='<?php echo $accountnumber; ?>'/></td>
</tr>
<tr>
<td style="color:red;background-color:aqua;" class="auto-style3">Title</td>
<td class="auto-style4">
<input id="Text2" type="text" value='<?php echo $title; ?>'/></td>
</tr>
<tr>
<td style="color:red;background-color:aqua;" class="auto-style3">FirstName:</td>
<td class="auto-style4">
<input id="Text3" type="text" value='<?php echo $fname; ?>' /></td>
</tr>
<tr>
<td style="color:red;background-color:aqua;" class="auto-style3">Surname:</td>
<td class="auto-style4">
<input id="Text4" type="text" value='<?php echo $lname; ?>' /></td>
</tr>
<tr>
<td style="color:red;background-color:aqua;" class="auto-style3">Address Line 1:</td>
<td class="auto-style4">
<input id="Text5" type="text" value='<?php echo $add1; ?>' /></td>
</tr>
<tr>
<td style="color:red;background-color:aqua;" class="auto-style3">Address Line 2:</td>
<td class="auto-style4">
<input id="Text6" type="text" value='<?php echo $add2; ?>' ></td>
</tr>
<tr>
<td style="color:red;background-color:aqua;" class="auto-style3">Town:</td>
<td class="auto-style4">
<input id="Text7" type="text" value='<?php echo $town; ?>'/></td>
</tr>
<tr>
<td style="color:red;background-color:aqua;" class="auto-style3">Country:</td>
<td class="auto-style4">
<input id="Text8" type="text" value='<?php echo $country; ?>' /></td>
</tr>
<tr>
<td style="color:red;background-color:aqua;" class="auto-style3">Post Code:</td>
<td class="auto-style4">
<input id="Text9" type="text" value='<?php echo $pin; ?>'/></td>
</tr>
<tr>
<td style="color:red;background-color:aqua;" class="auto-style3">Contact Number:</td>
<td class="auto-style4">
<input id="Text10" type="text" value='<?php echo $mob; ?>'/></td>
</tr>
<tr>
<td style="color:red;background-color:aqua;" class="auto-style3">Email Address:</td>
<td class="auto-style4">
<input id="Text11" type="text" value='<?php echo $mailid; ?>'/></td>
</tr>
<tr>
<td style="color:red;background-color:aqua;" class="auto-style3">User Name:</td>
<td class="auto-style4">
<input id="Text12" type="text" value='<?php echo $uname; ?>'/></td>
</tr>
<tr>
<td style="color:red;background-color:aqua;" class="auto-style3">Balance:</td>
<td>
<input id="Text13" type="text" value='<?php echo $balance; ?>' /></td>
</tr>
<tr>
<td></td>
</tr>
</table>
</form>
</body>
</html>

Answers (2)