| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
function inventorydb_list(){ |
|---|
| 4 |
$sql = "SELECT id, empname FROM inventorydb"; |
|---|
| 5 |
$results= sql($sql, "getAll"); |
|---|
| 6 |
|
|---|
| 7 |
foreach($results as $result){ |
|---|
| 8 |
$inventorys[] = array($result[0],$result[1]); |
|---|
| 9 |
} |
|---|
| 10 |
return isset($inventorys)?$inventorys:null; |
|---|
| 11 |
} |
|---|
| 12 |
|
|---|
| 13 |
function inventorydb_get($extdisplay){ |
|---|
| 14 |
$sql="SELECT * FROM inventorydb where id=$extdisplay"; |
|---|
| 15 |
$results=sql($sql, "getRow", DB_FETCHMODE_ASSOC); |
|---|
| 16 |
return isset($results)?$results:null; |
|---|
| 17 |
} |
|---|
| 18 |
|
|---|
| 19 |
function inventorydb_add($empnum, $empname, $building, $floor, $room, $section, $cubicle, $desk, $exten, $phusername, $phpassword, $mac, $serial, $device, $distdate, $ip, $pbxbox, $extrainfo){ |
|---|
| 20 |
$sql = "INSERT INTO inventorydb(empnum, empname, building, floor, room, section,"; |
|---|
| 21 |
$sql .= "cubicle, desk, exten, phusername, phpassword, mac, serial, device,"; |
|---|
| 22 |
$sql .= "distdate, ip, pbxbox, extrainfo)"; |
|---|
| 23 |
|
|---|
| 24 |
$sql .= "VALUES ('$empnum', '$empname', '$building', '$floor', '$room', '$section',"; |
|---|
| 25 |
$sql .= "'$cubicle', '$desk', '$exten', '$phusername', '$phpassword', '$mac', '$serial',"; |
|---|
| 26 |
$sql .= "'$device', '$distdate', '$ip', '$pbxbox', '$extrainfo')"; |
|---|
| 27 |
sql($sql); |
|---|
| 28 |
} |
|---|
| 29 |
|
|---|
| 30 |
function inventorydb_del($extdisplay){ |
|---|
| 31 |
$sql="DELETE FROM inventorydb where id=$extdisplay"; |
|---|
| 32 |
sql($sql); |
|---|
| 33 |
} |
|---|
| 34 |
|
|---|
| 35 |
function inventorydb_edit($extdisplay, $empnum, $empname, $building, $floor, $room, $section, $cubicle, $desk, $exten, $phusername, $phpassword, $mac, $serial, $device, $distdate, $ip, $pbxbox, $extrainfo){ |
|---|
| 36 |
$sql="UPDATE inventorydb set empnum='$empnum' where id='$extdisplay'"; |
|---|
| 37 |
sql($sql); |
|---|
| 38 |
$sql="UPDATE inventorydb set empname='$empname' where id='$extdisplay'"; |
|---|
| 39 |
sql($sql); |
|---|
| 40 |
$sql="UPDATE inventorydb set building='$building' where id='$extdisplay'"; |
|---|
| 41 |
sql($sql); |
|---|
| 42 |
$sql="UPDATE inventorydb set floor='$floor' where id='$extdisplay'"; |
|---|
| 43 |
sql($sql); |
|---|
| 44 |
$sql="UPDATE inventorydb set room='$room' where id='$extdisplay'"; |
|---|
| 45 |
sql($sql); |
|---|
| 46 |
$sql="UPDATE inventorydb set section='$section' where id='$extdisplay'"; |
|---|
| 47 |
sql($sql); |
|---|
| 48 |
$sql="UPDATE inventorydb set cubicle='$cubicle' where id='$extdisplay'"; |
|---|
| 49 |
sql($sql); |
|---|
| 50 |
$sql="UPDATE inventorydb set desk='$desk' where id='$extdisplay'"; |
|---|
| 51 |
sql($sql); |
|---|
| 52 |
$sql="UPDATE inventorydb set exten='$exten' where id='$extdisplay'"; |
|---|
| 53 |
sql($sql); |
|---|
| 54 |
$sql="UPDATE inventorydb set phusername='$phusername' where id='$extdisplay'"; |
|---|
| 55 |
sql($sql); |
|---|
| 56 |
$sql="UPDATE inventorydb set phpassword='$phpassword' where id='$extdisplay'"; |
|---|
| 57 |
sql($sql); |
|---|
| 58 |
$sql="UPDATE inventorydb set mac='$mac' where id='$extdisplay'"; |
|---|
| 59 |
sql($sql); |
|---|
| 60 |
$sql="UPDATE inventorydb set serial='$serial' where id='$extdisplay'"; |
|---|
| 61 |
sql($sql); |
|---|
| 62 |
$sql="UPDATE inventorydb set device='$device' where id='$extdisplay'"; |
|---|
| 63 |
sql($sql); |
|---|
| 64 |
$sql="UPDATE inventorydb set distdate='$distdate' where id='$extdisplay'"; |
|---|
| 65 |
sql($sql); |
|---|
| 66 |
$sql="UPDATE inventorydb set ip='$ip' where id='$extdisplay'"; |
|---|
| 67 |
sql($sql); |
|---|
| 68 |
$sql="UPDATE inventorydb set pbxbox='$pbxbox' where id='$extdisplay'"; |
|---|
| 69 |
sql($sql); |
|---|
| 70 |
$sql="UPDATE inventorydb set extrainfo='$extrainfo' where id='$extdisplay'"; |
|---|
| 71 |
sql($sql); |
|---|
| 72 |
|
|---|
| 73 |
} |
|---|
| 74 |
|
|---|
| 75 |
?> |
|---|