This topic is locked

Display Filed and Check Date

5/25/2011 1:59:38 AM
PHPRunner General questions
C
carrie3800332 author

Hello,All: I Have Some questions
1.What Can Display Filed(apply_no )?echo $values['apply_no'] Have '00000001' But Not Display to this Filed?

Use Table Events The Add page:Before process
$strSQL="select max(apply_no) as max_apply_no from ticket_m ";

//echo $strSQL;

$rs = db_query($strSQL,$conn);

$data=db_fetch_array($rs);

echo "This text1.";
//echo $data['max_apply_no'];
if($data['max_apply_no']!='')

{

$apply_no=$data['max_apply_no']+1;

$_SESSION['apply_no']=sprintf("%08s",$apply_no);

echo $values['apply_no'];
}else{

$values['apply_no']=sprintf("%08s",'00000001');

$_SESSION["apply_no"] = $values['apply_no'];

echo $_SESSION["apply_no"];
}
return true;
2.I Want To Check Date Show " syntax error, unexpected T_STRING, expecting '(' in line 1" ?

Use Table Events The Add page:record added
if dict("thru_date") > dict("from_date") then;

Response.Write "有限期限(起) > 有限期限(迄)";

BeforeEdit = False;

else;

BeforeEdit = True;

end if;

let dict("thru_date")= ("Y")+1;
Thank you again for your support.

J
Jane 6/1/2011

Hi,
please see my answers below:

  1. your SQL query returns actual value from apply_no field. I suppose you need to select display field value from lookup table manually based on current apply_no value in your code:

$strSQL="select max(apply_no) as max_apply_no from ticket_m ";

//echo $strSQL;

$rs = db_query($strSQL,$conn);

$data=db_fetch_array($rs);
$strSQL2="select DisplayField from LookupTable where LinkField=".$data['max_apply_no'];

//echo $strSQL;

$rs2 = db_query($strSQL2,$conn);

$data2=db_fetch_array($rs2);

...



where LinkField and DisplayField are your actual field names, LookupTable is your actual table name.
2. it's ASP code, not PHP. Please re-write it in PHP.