heshan Posted August 12, 2011 Share Posted August 12, 2011 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 ?> Quote Link to comment https://forums.phpfreaks.com/topic/244631-problem-arsie-while-retrieving-data/ Share on other sites More sharing options...
jcbones Posted August 12, 2011 Share Posted August 12, 2011 You will only get one row, unless you put the mysql_fetch function in a while loop. Quote Link to comment https://forums.phpfreaks.com/topic/244631-problem-arsie-while-retrieving-data/#findComment-1256485 Share on other sites More sharing options...
heshan Posted August 12, 2011 Author Share Posted August 12, 2011 Where i should enter the while loop? Quote Link to comment https://forums.phpfreaks.com/topic/244631-problem-arsie-while-retrieving-data/#findComment-1256495 Share on other sites More sharing options...
heshan Posted August 15, 2011 Author Share Posted August 15, 2011 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"; Quote Link to comment https://forums.phpfreaks.com/topic/244631-problem-arsie-while-retrieving-data/#findComment-1257739 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.