Hi friends

Please help me it is out of my head, I am pussing date and other variables value through url. Some time date is entering correctly in date field and some time entering 000-00-00.

Please help me out.

<?php
include '../require.php';

$date=mysql_real_escape_string($_REQUEST['id']);

$app_id=$_REQUEST['app'];
$branch=$_REQUEST['branch'];
$ins=$_REQUEST['ins'];
$ins=$ins+1;
//echo $app_id;
//$rr="select * from 013client where client_id='$app_id'";
//echo $rr;
$er=mysql_query("select * from 013client where client_id='$app_id'");
$re=mysql_fetch_array($er);
$prd_type=$re['prod_type_id'];

$prd_id=$re['product_id'];
if($prd_type==1)
{
    $total_amount=$re['monthly_mis'];
    $recpt_no="MIP".rand(1000000000,9999999999);
}
else
{
    $total_amount=$re['amount'];
    $recpt_no="MIPB".rand(1000000000,9999999999);
}
$ag_id=$re['agent_id'];
$dt_by=$date;
$duration=fetchreturn('duration','004add_product','id',$prd_id);

$rs=mysql_query("insert into 018renewal values('',$prd_type,$prd_id,'$app_id','$date',$total_amount,'paid','$dt_by','$branch',$ins)");


if($prd_type==1)
{
$tr=mysql_query("insert into print_details values('',$prd_type,$prd_id,'$app_id','cash','$branch','$recpt_no','$dt_by','$date','mipvoucher')");
}
else
{
$tr=mysql_query("insert into print_details values('',$prd_type,$prd_id,'$app_id','cash','$branch','$recpt_no','$dt_by','$date','renewal')");
}
?>

Recommended Answers

All 3 Replies

If you get 0000-00-00 it means it was either not set, or invalid. You'll have to make sure the format is 'yyyy-mm-dd'

insert into 018renewal values('',2,25,'100404','2013-2-30',300,'paid','2013-2-30','HEAD_OFFICE',5)

check this i think it is

check your $date variable is it having any value

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.