Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ini_set('display_errors', 1);
- ini_set('display_startup_errors', 1);
- error_reporting(E_ALL);
- include("db.php");
- $defect = $_POST['defect'];
- $idwood = $_POST['idwood'];
- wlog("defect=".$defect);
- if($defect && $defect == "defect")
- {
- $defect = array();
- $tsql = "select defect.id,defecttype.[type],defect.iddefecttype,defect.[length] from Defect INNER JOIN defecttype
- ON Defect.iddefecttype = DefectType.id where idwood = '$idwood' ";
- $stmt = sqlsrv_query( $conn, $tsql);
- $row = sqlsrv_fetch_array($stmt);
- while( $row = sqlsrv_fetch_array($stmt))
- {
- array_push($defect, array("id"=>$row['defect.id'], "type"=>$row['defecttype.[type]'], "idtype"=>$row['defect.iddefecttype'],"length"=>$row['defect.[length]']));
- //, "type"=>$row['defecttype.[type]']), "idtype"=>$row['defect.iddefecttype'],"length"=>$row['defect.[length]']
- }
- wlog('defect = '.serialize($defect));
- echo json_encode($defect);
- sqlsrv_free_stmt( $stmt);
- sqlsrv_close( $conn);
- }
- function wlog($message)
- {
- $d=date("Y-m-d H:i:s");
- file_put_contents("D:\phpemil\logs", "\n $d ".$message, FILE_APPEND);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement