codebang
Posts: 74
|
| Posted: 01/02/2009, 1:40 AM |
|
i have this set of code, which u will see below.i want to do the following and please help me out!!!!.
i want to add the system YEAR automatically instead of changing it every year.
Below u will see what i mean.
function InsertRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeInsert", $this);
if(!$this->InsertAllowed) return false;
// Setting Up the Job Number Value
$job_no="";
$job_no="SUD-09-";
$last_id=0;
$db= new clsDBTCSS();
$qry="Select cnt from job_plan_cnt";
$db->query($qry);
$result=$db->next_record();
if($result){
$last_id=$db->f("cnt");
$last_id=$last_id+1;
}
// Getting the Rig Name
$user_rig_name=$this->rig_name->GetValue(true);
$pos=strpos($user_rig_name,"");
$rig_name=substr($user_rig_name,$pos);
// Forming the Job Number
$job_no="SUD-09-".$rig_name."-".$last_id;
echo "New Job No:".$job_no;
// Updating the Last Id Value
$upd_qry="update job_plan_cnt set cnt=".$last_id;
// echo "New Job No:".$job_no;
$db->query($upd_qry);
// Closing the Database Connection
$db->close();
Ok...
now on the Job no u will notice ""SUD-09"..
This 09 should be automatically programmed to get the system year.
So can anyone help... PLEASE!!!!!
Salah Hafiz Midhat.
|
 |
 |
damian
Posts: 838
|
| Posted: 01/02/2009, 4:23 AM |
|
// Setting Up the Job Number Value
$job_no="SUD-".date("y");
case sensitive.... Y is 4 digit year, y is 2 digit year.....
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
codebang
Posts: 74
|
| Posted: 01/02/2009, 9:27 AM |
|
Man i dunno how to thank u...
Thank u very much...
U r an amazing person
Thank u very much.
Salah Hafiz.
|
 |
 |
|