Jump to content

Problem arsie while retrieving data


heshan

Recommended Posts

Hi,

 

There are 2 pages in this section. One page includes a text field to enter the account number and click on "Search" button. (check_data.php)

The other page should retrieve data based on the account number. (modify_data.php)

 

The problem is ONLY one record set has been displayed irrespective of whatever search in the account number field. Need your help to solve the problem.

Here is my codings.

 

check_data.php

 

<form method="post" action="modify_data.php">
  <div>Enter Account Number:
    <input type="text" name="account_number" value="" />
      <input type="submit" value="Search"/>
  </div>
</form>

 

modify_data.php

 

<form name="form1" action="approve_data.php">
  <fieldset>
  <legend class="cap">Customer details</legend>
  <table width="75%" border="0" cellspacing="0" cellpadding="5" align="center">
  
<?php
  
$connect=mysql_connect('localhost','root','');
mysql_select_db('bank',$connect);  

$full_name = '';
$name_with_initials = '';
$phone_number = '';
$address = '';
$gender = '';
$date_of_birth = '';
$account_type = '';
$fd_period = '';

$query ="SELECT account_details.full_name,phone_number,address,gender,date_of_birth,account. name_with_initials,account_type,fd_period FROM account_details,account WHERE account_details.account_number=account.account_number";

$result=mysql_query($query) or die( mysql_error() );

  if( mysql_num_rows($result)==0 )
  {
    echo "<p> No records found.</p>";

  }	
  else{
$row=mysql_fetch_array($result);

$full_name = $row['full_name'];
$name_with_initials = $row['name_with_initials'];
$phone_number = $row['name_with_initials'];
$address = $row['address'];
$gender = $row['gender'];
$date_of_birth = $row['date_of_birth'];
$account_type = $row['account_type'];
$fd_period = $row['fd_period'];

// text box values with captured data		
  
?>

  

Link to comment
https://forums.phpfreaks.com/topic/244631-problem-arsie-while-retrieving-data/
Share on other sites

I have tried it. But now all the records were displayed irrespective of the account number. Is there any error with my query?

 

$query ="SELECT account_details.full_name,phone_number,address,gender,date_of_birth,account. name_with_initials,account_type,fd_period FROM account_details,account WHERE account_details.account_number=account.account_number";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.