I am facing the problem that when I try to update the amount field in table using query in php code then it is not working. See this image:
But if i did this removing by the financial year field then it is working......
My php code is:
if(isset($_POST['mid_update']))
{
echo $subscription3=$_POST['subscription'];
echo $member_type3=$_POST['member_type'];
echo $financial_year3=$_POST['financial_year'];
echo $amount3=$_POST['amount'];
$qry=mysqli_query($con,"update dbo_tbfeemaster set nu_amount='$amount3' where nu_sub_id='$subscription3' and vc_member_type='$member_type3' and vc_financial_year='$financial_year3'");
if($qry)
{
header("location:subscription_fee_master.php?w=updation success");
}
else
{
header("location:subscription_fee_master.php?w=updation not success");
}
}
With this code the updation is successful showing but table is not updating.
I change date format as:
<option value="<?php $dat1=$q['dt_period_start_date'];
echo date("d-M-Y",strtotime($dat1));?> to <?php $dat2=$q['dt_period_end_date'];
echo date("d-M-Y",strtotime($dat2));?>">
And is equal to the same as database financial year column...
Everthing is going fine then why my table is not updating. Any suggestion would be highly appreciated and feel free to ask me if i forget something to mention here regarding my problem...
It looks like the date formats you use in the query don't line up. Try something like this to make sure the formats are the same. You might want to split those two dates up and store them in separate columns. Which would make this a lot easier imho.
$dateStr = '2011-04-01 to 2012-03-31';
$parts = explode('to', $dateStr);
$result = array_map(function($value) {
$date = date_create(trim($value));
return date_format($date, 'd-M-Y');
}, $parts);
$dateStr = implode(' to ', $result);