0

In the below query,the "Account has been successfully approved" message dispayed. But in the database still approved_status remains '0'.

<?php
   
$connect=mysql_connect('localhost','root','');
mysql_select_db('bank',$connect);


if(isset($_POST['account_number']))
    $account_number=$_POST['account_number'];
else
    $account_number='';
	
$query = "UPDATE account_details SET approved_status='1' WHERE account_number='$account_number'";
$result= mysql_query($query) or die(mysql_error());

   if ($result)
   {
      echo "Account has been successfully approved";
   }
   
  
   
?>
3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by urtrivedi
0

There is no ; at the end of the sql query to tell MySQL to execute the code. Try this:

$query = "UPDATE account_details SET approved_status='1' WHERE account_number='$account_number';";
$result= mysql_query($query) or die(mysql_error());
0

I have already included it. But it still not working...

0

echo query before executing (as i did it below), then run page in browser, copy query and run in phpmyadmin, see where query updates account.
I think your account number is not matching.

<?php
   
$connect=mysql_connect('localhost','root','');
mysql_select_db('bank',$connect);


if(isset($_POST['account_number']))
    $account_number=$_POST['account_number'];
else
    $account_number='';
	
$query = "UPDATE account_details SET approved_status='1' WHERE account_number='$account_number'";
echo $query."<br>";
$result= mysql_query($query) or die(mysql_error());

   if ($result)
   {
      echo "Account has been successfully approved";
   }
   
  
   
?>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.