Code: Select all
$position = sprintf("'%s'",$_POST['position']);
$criteria = sprintf("'%s'",$_POST['criteria']);
$sendto = (empty($_POST['Name']))? "DEFAULT" : sprintf("'%s'",$_POST['Name']);
$email = (empty($_POST['Email']))? "DEFAULT" : sprintf("'%s'",$_POST['Email']);
$exp_day = $_POST['Exp_Day'];
$exp_month = $_POST['Exp_Month'];
$exp_year = $_POST['Exp_Year'];
$publish = sprintf("'%s'",$_POST['publish']);
$image_file = (empty($_POST['file']))? "NULL" : sprintf("'%s'",$_POST['file']);
// if the deadline date is not empty
if((!empty($exp_day)) && !empty($exp_month)){
$postdate = sprintf("'%s'",date("Y-m-d",mktime(0,0,0,$themonth,$theday,$theyear)));
$deadline = sprintf("'%s'",date("Y-m-d",mktime(0,0,0,$exp_month,$exp_day,$exp_year)));
// query string
$query = sprintf("INSERT INTO careers VALUES ('',%s,%s,%s,%s,%s,%s,%s,%s)",$postdate,$position,$image_file,$criteria,$deadline,$email,$sendto,$publish);Code: Select all
CREATE TABLE careers (
rec_id int(12) NOT NULL auto_increment,
postdate date NOT NULL default '0000-00-00',
position varchar(255) default NULL,
image_file varchar(255) default NULL,
criteria mediumtext,
deadline date NOT NULL default '0000-00-00',
sendto varchar(255) NOT NULL default 'HR Dept.',
sender_name varchar(255) NOT NULL default 'jobs@hadcoltd.com',
publish set('Y','N') NOT NULL default 'Y',
PRIMARY KEY (rec_id),
KEY postdate (postdate,position,deadline),
FULLTEXT KEY criteria (criteria)
) TYPE=MyISAM;how do you use this?NOte the VALUES ({expr | DEFAULT},...
Kendall