-
Notifications
You must be signed in to change notification settings - Fork 0
/
addMoreProjectCallProcess.php
57 lines (53 loc) · 1.99 KB
/
addMoreProjectCallProcess.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
$callId = $_REQUEST['callId'];
$brokerId = $_REQUEST['brokerId'];
$projectId = $_REQUEST['projectId'];
$smarty->assign("callId", $callId);
$smarty->assign("brokerId", $brokerId);
$smarty->assign("projectId", $projectId);
$selectedVal = '';
$smarty->assign("selectedVal", selectedVal);
$ErrorMsg = array();
if(isset($_REQUEST['exit'])){
header("Location:secondary_price.php?projectId=$projectId");
}
if(isset($_REQUEST['submit'])){
include("dbConfig.php");
$arrProjectListInValid = array();
$flag = 0;
foreach($_REQUEST['multiple_project'] as $k=>$v) {
if($v !='') {
$flag = 1;
$projectdetail = projectdetail($v);
if( count($projectdetail) != 0) {
$arrProjectListValid[] = $v;
}
else {
$arrProjectListInValid[] = $v;
}
}
}
if($flag == 0)
$ErrorMsg['noPid'] = 'Please enter atleast one project id';
if(count($ErrorMsg['noPid']) == 0) {
$cnt = 1;
$comma = ',';
$qryIns = "INSERT IGNORE INTO CallProject (CallId,ProjectId,BROKER_ID)
VALUES ";
foreach($arrProjectListValid as $val) {
if($cnt == count($arrProjectListValid))
$comma = '';
$qryIns .= "($callId, $val, $brokerId)$comma";
$cnt++;
}
$resIns = mysql_query($qryIns) or die(mysql_error());
if($resIns)
$ErrorMsg['success'] = "Data has been inserted successfully!";
if(count($arrProjectListInValid)>0) {
$str = implode(", ",$arrProjectListInValid);
$ErrorMsg['wrongPId'] = "You cant enter wrong project ids which are following: $str";
}
}
}
$smarty->assign("ErrorMsg", $ErrorMsg);
?>