TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mark Tabor
587
2k
460.5k
I have a mysql and in which i set datetime column as nvarcha
Jul 31 2018 3:09 AM
I have mysql and in which i have date column set to varchar instead of date time and it store date in this format 07/17/2018 now i want o use between operator in my query but it does not work because the data type is varchar and between can only be applied on datetime column what to do now
function
datevisereport()
{
global $tprefix,$con;
$data=
''
;
$grandtotal=0;
$start_date=$_POST[
'start_date'
];
$to_date =$_POST[
'end_date'
];
$query=
"SELECT * FROM plan_voucher WHERE location="
.$_SESSION[
'role'
].
" and created_at between '"
.$start_date.
"' and '"
.$to_date.
"'"
;
$vouceher=mysqli_query($con,$query);
while
($getvoucher=mysqli_fetch_array($vouceher))
{
$acamount=0;
$vdquery=
'select * from plan_vdetails where vid='
.$getvoucher[
'id'
].
''
;
$vdetails=mysqli_query($con,$vdquery);
while
($getvdetails=mysqli_fetch_assoc($vdetails))
{
if
($getvdetails[
'transtype'
]==
'DR'
)
{
$amountdr=$getvdetails[
'amount'
];
$amountdcr=0;
}
else
{
$amountdcr=$getvdetails[
'amount'
];
$amountdr=0;
}
if
($getvdetails[
'isrectify'
]==1)
{
$bgcolor=
'bgcolor="yellow"'
;
}
else
{
$bgcolor=
''
;
}
$data.=
'<tr '
.$bgcolor.'>
<td>
'.$getvoucher['
created_at
'].'
</td>
<td>
'.$getvoucher['
voucherno
'].'
</td>
<td width=
"40%"
>
'.$getvdetails['
glid
'].'
-
'.getSingleValue('
accounts
','
account_no
','
where id=
'.$getvdetails['
aid
']).'
<br>
'.$getvdetails['
description
'].'
_
'.getSingleValue('
employees
','
fullname
','
where id=
'.$getvdetails['
claim_person
']).'
</td>
<td>
'.$amountdr.'
</td>
<td>
'.$amountdcr.'
</td>
<td>
'.$getvdetails['
rbalance
'].'
</td>
</tr>';
$acamount=$acamount+$amountdr;
}
$grandtotal=$grandtotal+$acamount;
$data.='<tr>
<td></td>
<td></td>
<td></td>
<td style=
"border-bottom:1px solid balck;"
><strong>
'.$acamount.'
.00<strong></td>
<td></td>
</tr>';
}
$data.='<tr>
<td></td>
<td></td>
<td style=
"border-bottom:1px solid balck;"
align=
"right"
>Grand Total:</td>
<td style=
"border-bottom:1px solid balck;"
><strong>
'.$grandtotal.'
.00<strong></td>
<td></td>
</tr>';
return
makepdf($data,$start_date,$to_date);
}
Reply
Answers (
8
)
MS office, Excel, 2007
create Schema with HeidiSQL