Jump to content

how to approve account based on customer ID


heshan

Recommended Posts

Hi guys,

 

I want something to be clarified.

 

The supervisor of my system is responsible for approving accounts. When he logged into the system he should be able to view the customer records based on customer ID. That is when he types the relevant customer ID and clicks on search button the relevant record is displayed in a form. That part is OK.

 

Thereafter he should approve the account by clicking on "Approve Account" button. I want to know how can he make sure relevant customer_id is approved or not.

 

customer table includes fields of,

  customer_id, nic, full_name, name_with_initials, address, contact_number, gender.

 

I want to whether i have add an extra field to my customer table saying "approves status" or whatever.

Can anyone give me a suggestion??

 

Thanks,

Heshan

 

 

 

Link to comment
Share on other sites

Hi,

 

If you have say another field.

 

account_status

enum

'0','1'

 

with 0 being unapproved and 1 being approve, when someone clicks on the button, it will change the id you selected to 1, then you can have a little approval message which says which one is approved so say...

 

ID 1

Status Approved

Link to comment
Share on other sites

@Shp0ngl3,

i made a query according to you. This is how it looks like. I want a message to be appeared as " Details have been successfully approved" How could i do that?

<?php
   
$connect=mysql_connect("localhost","root","");
mysql_select_db("bank",$connect) or die ("could not select database");

   $query = "select* from customer where approved='0'";
   mysql_query($query) or die(mysql_error());
   
   $query = "UPDATE customer SET approved='1'
   WHERE approved='0'";
   mysql_query($query) or die(mysql_error());
   
   ?>

 

 

@brown 2005,

  It is better to apply another field and state whether the account is approved or not. But i am  confusing about that. Can you give me an example coding?

 

 

Link to comment
Share on other sites

Try something like this

 

<?php
   
$connect=mysql_connect("localhost","root","");
mysql_select_db("bank",$connect) or die ("could not select database");

   $query = "select * from customer where approved='0'";
   mysql_query($query) or die(mysql_error());
   
   $query = "UPDATE customer SET approved='1'
   WHERE approved='0'";
   $result = mysql_query($query) or die(mysql_error());

   if ($result)
   {
      echo "Details have been successfully approved";
   }

?>

Link to comment
Share on other sites

this...

 

$query = "UPDATE customer SET approved='1'  WHERE approved='0'";  $result = mysql_query($query) or die(mysql_error());

would result in ALL customers being approved.

its needs to be ...

$query = "UPDATE customer SET approved='1'   WHERE customer_id = '$the_particular_customer_id'";   $result = mysql_query($query) or die(mysql_error());

Link to comment
Share on other sites

@ litebearer, you are right. i want something that to be done. I need to approve customers one by one.

But this coding i made not worked.Can anyone help me out......

 

<?php
   
$connect=mysql_connect("localhost","root","");
mysql_select_db("bank",$connect) or die ("could not select database");

    if(isset($_POST['customer_id'])){ 
$customer_id=$_POST['customer_id']; 


	$query = "SELECT * from customer WHERE approved='0'";
    mysql_query($query) or die(mysql_error());
   
   $query = "UPDATE * from customer WHERE customer_id='$customer_id'";
   $result = mysql_query($query) or die(mysql_error());
  
   

   if ($result)
   {
      echo "Customer details have been successfully approved";
   }

}

?>

Link to comment
Share on other sites

Psuedo code...

 

form page

 

1. connect to db

2. select all where not approved

3. loop thru results

    while($row = mysql_fetch_array[$result] {

      echo the customer name as a check box where the value of the check box is the cust-id

    end loop

4. when submit is entered go to process page

 

process page

check to see which check boxes were selected

update those records

display the customers that were updated

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.