0byt3m1n1
Path:
C:
/
wamp64
/
www
/
cpms_new
/
USER
/
[
Home
]
File: addstockcategory_ctrl.php
<?php require_once "../lib/config.php"; include( "../lib/config.php"); include_once("../model/defaults_mdl.php"); require_once BASE_DIR."/lib/db/connection.php"; require_once "../model/defaultValues_mdl.php"; $groupname=""; $error_flag=0; $stockaccname_restore=@$_POST['txtstockaccount']; //---------Null---/ if($stockaccname_restore=="") { $error['stockaccname_null']="Please Enter Accountname"; $error_flag=1; } $u_id=@$_SESSION['user_id']; $p_id=@$_SESSION['project_id']; $sql="select `category_name` from stockcategory where user_id='$u_id' and category_name='$stockaccname_restore'"; mysql_query($sql); if (mysql_affected_rows()>0) { $error['stockaccname_exist']="Accountname exist"; $error_flag=1; } if($error_flag==1) { include("addstockcategory.php"); exit(); } else { $table_id=Common::getTableID("stockcategory","category_id"); $table_id=$table_id+1; $u_id=@$_SESSION['user_id']; $p_id=@$_SESSION['project_id']; $sql="INSERT INTO `stockcategory`( `category_id`, `user_id`, `category_name` ) VALUES ('$table_id','$u_id','$stockaccname_restore')"; mysql_query($sql); if (mysql_affected_rows()>0) { $message="Registration Completed successfully"; include("addstockcategory.php"); exit(); } else { $message= "Registration Failed.Invalid characters found"; include("addstockcategory.php"); exit(); } } ?>