php - Date format: not updating existing record -


i working on project have update record on basis of date, record not updating , if update record without date clouse working fine. have change format of date becouse date in mysql table column in different format.

ist changed date format as:

<option value="<?php $dat1=$q['dt_period_start_date']; //for example $dat1=2011-04-01; echo date('d-m-y',strtotime($dat1));?>&nbsp;to&nbsp;<?php $dat2=$q['dt_period_end_date']; echo date('d-m-y',strtotime($dat2));?>">  //now have date in 01-apr-2011 31-mar-2012 format 

2nd have update date

for updating using this:

$qry=mysqli_query($con,"update dbo_tbfeemaster set nu_amount='$amount3' nu_sub_id='$subscription3' , vc_member_type='$member_type3' , vc_financial_year='$financial_year2' "); 

and code not working , data not being update.

3rd if give date manualy

if give static fetched database date in sql query code working fine , record update. see code:

 $qry=mysqli_query($con,"update dbo_tbfeemaster set nu_amount='$amount3' nu_sub_id='$subscription3' , vc_member_type='$member_type3' , vc_financial_year='01-apr-2010 31-mar-2011' "); 

it showing fine...actualy if use '$financial_year2' in query not working fine if use static date '01-apr-2010 31-mar-2011' working fine.....and if echo $financial_year2 give same '01-apr-2010 31-mar-2011

i have made possible can unknown root cause of problem, let me know , why data not updating , how resolve it....

thanks in advance.

if have query works, easy see wrong. echo queries together. make echo instead of mysqli_query().yup, simple that.

echo "update dbo_tbfeemaster set nu_amount='$amount3' nu_sub_id='$subscription3' , vc_member_type='$member_type3' , vc_financial_year='$financial_year2'"; echo "<br>"; echo "update dbo_tbfeemaster set nu_amount='$amount3' nu_sub_id='$subscription3' , vc_member_type='$member_type3' , vc_financial_year='01-apr-2010 31-mar-2011' "; 

and see have done wrong immediately!


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -