Jump to content

Search the Community

Showing results for tags 'mssql'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (Dreamweaver, Zend, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 13 results

  1. Good morning, I am trying to return specific values depending on the value of the WJCStatusID, for example if WJCStatusID = < 4 but > 2 return "In production" SQL QUERY: SELECT tblWJCItem.AddedDescription, tblWJC.WJCPrefix + Convert(Varchar(10),tblWJC.WJCNo) AS OurRef, tblWJCItem.MaterialName, tblStockFamily.StockFamily, tblWJCItem.WeightToSend, tblWJC.DateCreated, tblWJC.WJCStatusID FROM tblWJC INNER JOIN tblWJCItem ON tblWJC.WJCID = tblWJCItem.WJCID INNER JOIN tblStockFamily ON tblWJCItem.ProductFamilyID = tblStockFamily.StockFamilyID IF (tblWJC.WJCStatusID) < 2 THEN 'Pre Production' ELSE IF (tblWJC.WJCStatusID) < 4 THEN 'In Production' ELSE IF (tblWJC.WJCStatusID) > 4 THEN 'Ready To Ship' ELSE 'Awaiting Lab Results'; I am quite new to the world of mssql so I maybe doing something wrong which is quite simply to fix. Can any body help?
  2. This is posting to any row in mssql that has a matching 'start_date'. I would like it to post rows where start_date = '$start_date' and it also matches the 'meter_id' . It should perform this check of both parameters before posting to mssql. <?php $session_id = $_SESSION['id']; $comm_id = $_GET['meter_id']; $start_date = $_GET['start_date']; $payment_date = $_POST['payment_date']; $amount_paid = $_POST['amount_paid']; $check_number = $_POST['check_number']; $sql = "UPDATE [radiogates].[dbo].[ops_invoice_history] SET payment_date = '$payment_date', amount_paid = '$amount_paid', check_number = '$check_number' where start_date = '$start_date'"; $query = sqlsrv_query($conn, $sql); Thank you for any help.
  3. Good afternoon, I am working on a project that gives the user a data table and a google chart (using the api) based on what the user selects for a <select> <option>. Index.PHP code: <form> <select name="users" onchange="showUser(this.value);drawChart();"> <option value=""> Select a Metal: </option> <?php //connection details $query = "SELECT TOP(31) tblMetalPrice.MetalSourceID, tblMetalSource.MetalSourceName from tblMetalPrice INNER JOIN tblMetalSource ON tblMetalPrice.MetalSourceID=tblMetalSource.MetalSourceID ORDER BY tblMetalPrice.DateCreated DESC "; $result = sqlsrv_query( $conn, $query); while( $row = sqlsrv_fetch_object ($result)) { echo "<option value='".$row->MetalSourceID ."'>". $row->MetalSourceName ."</option>"; } sqlsrv_close( $conn); ?> </select> </form> <div id="chart_div"></div> <div id="txtHint"><b>Past metal information will be generated below.</b></div> this works fine and generates the list in the select option dropdown Script to get table contents: <script> function showUser(str) { if (str=="") { document.getElementById("txtHint").innerHTML=""; return; } if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","scripts/gettabledata001.php?q="+str,true); xmlhttp.send(); } </script> this also works fine and generates the table contents based on 'q' value from the select dropdown. Google API script: <script type="text/javascript"> // Load the Visualization API and the piechart,table package. google.load('visualization', '1', {'packages':['corechart']}); google.setOnLoadCallback(drawChart()); function drawChart() { var jsonData = $.ajax({ url: "scripts/getgraphdata.php", dataType:"json", data: "q="+num, async: false }).responseText; // Instantiate and draw our pie chart, passing in some options. var chart = new google.visualization.LineChart(document.getElementById('chart_div')); chart.draw(data, {width: 400, height: 240}); } </script> getgraphdata.php script: $q = intval($_GET['q']); ini_set('display_errors',1); ini_set('display_startup_errors',1); error_reporting(-1); $query ="SELECT TOP(30) tblMetalPrice.MetalSourceID, tblMetalPrice.DateCreated, tblMetalPrice.UnitPrice, tblMetalPrice.HighUnitPrice, tblMetalSource.MetalSourceName FROM tblMetalPrice INNER JOIN tblMetalSource ON tblMetalPrice.MetalSourceID = tblMetalSource.MetalSourceID WHERE tblMetalPrice.MetalSourceID = '".$q."' ORDER BY tblMetalPrice.DateCreated DESC"; $result = sqlsrv_query($conn, $query); echo "{ \"cols\": [ {\"id\":\"\",\"label\":\"Date\",\"pattern\":\"\",\"type\":\"string\"}, {\"id\":\"\",\"label\":\"Unit Price\",\"pattern\":\"\",\"type\":\"number\"} ], \"rows\": [ "; $total_rows = sqlsrv_num_rows($result); $row_num = 0; while($row = sqlsrv_fetch_object($result)){ $row_num++; if ($row_num == $total_rows){ echo "{\"c\":[{\"v\":\"" . $row->DateCreated->format('d-m-Y') ."\",\"f\":null},{\"v\":" . $row->UnitPrice . ",\"f\":null}]}"; } else { echo "{\"c\":[{\"v\":\"" . $row->DateCreated->format('d-m-Y') ."\",\"f\":null},{\"v\":" . $row->UnitPrice . ",\"f\":null}]}, "; } } echo " ] }"; sqlsrv_close( $conn); When ever i try these they don't work the getgraphdata.php scripts runs fine the issue I believe but may be totally wrong may be done to the google api script that should generate the chart but doesn't. Can anyone help here I've been trying to sort this for a few days now and losing confidence in myself rapidly. Thanks Kris
  4. I have a stored procedure with 2 parameters. I'm able to execute stored procedures with one parameter using the same script below. But I couldn't make it work with two parameters. $stmt = "{CALL VM_GETPRs_CAMPS (?,?)}";**//SP has 160 rows of data.** $fdate=date("Y-m-d"); $tdate=date("Y-m-d"); $params = array( array($fdate,SQLSRV_PARAM_IN), array($tdate,SQLSRV_PARAM_IN) ); $result = sqlsrv_query( $conn, $stmt,$params,array('Scrollable' => 'buffered')); //not getting any error if( $result === false) { die( print_r( sqlsrv_errors(), true) ); } else{ **//**I tried sqlsrv_num_rows and sqlsrv_has_rows sqlsrv_fetch_array all are giving zero rows.** $row_count = sqlsrv_num_rows( $result ); if ($row_count === false) echo "No rows"; else if ($row_count >=0) echo "\n$row_count\n"; //outputs 0 ---------------------------------- if(sqlsrv_has_rows($result)) echo "has rows"; else echo "No rows"; //outputs No rows ---------------------------------- $data = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC); var_dump($data); //outputs bool(false) I'm looking for a solution since four days. Please help me.
  5. Good morning, I am doing a small project including google charts API but I am having trouble getting my results into the json format that is required. Google's documentation states the json format should be: { "cols": [ {"id":"","label":"Topping","pattern":"","type":"string"}, {"id":"","label":"Slices","pattern":"","type":"number"} ], "rows": [ {"c":[{"v":"Mushrooms","f":null},{"v":3,"f":null}]}, {"c":[{"v":"Onions","f":null},{"v":1,"f":null}]}, {"c":[{"v":"Olives","f":null},{"v":1,"f":null}]}, {"c":[{"v":"Zucchini","f":null},{"v":1,"f":null}]}, {"c":[{"v":"Pepperoni","f":null},{"v":2,"f":null}]} ] } the query works perfectly fine thats not the problem but getting it into the above format is proving hard than I expected. The below is what I am trying to do to populate the json data in the correct format. function graphdata() { $array['cols'][] = array('type' => 'string'); $array['cols'][] = array('type' => 'string'); $array['cols'][] = array('type' => 'string'); $result = sqlsrv_query($conn, $query); while($row = sqlsrv_fetch_object($result)){ $array['rows'][] = array('c' => array( array('v'=>'$row->DateCreated->format('d-m-Y')'), array('v'=>$row->UnitPrice)) ); } return $array; } print json_encode(graphdata()); I am using MSSQL and not the normal mysql hence the above code, i am a starter when it comes to php so I may be doing something basic totally wrong but I cannot seem to get it to work. Thanks
  6. I have 5 dropdowns on a tab of a website. I have a database table in MS SQL Server. The table has all the data of 5 dropdowns with one of the fieldNames called Region_Name, say the Region_Names are A, B, C, D, and E. I have written codes to display a table and enabled row editing for one of the RegionNames. Now, I am wondering if I could modify the same codes to display associated table with row editing enabled using different queries when a dropdown is clicked. That could reduce the code repetition and improve the performance. But I do not know how to achieve this. Could anyone please give me some hints? I am using PHP PDO to connect to the database.
  7. Hello, I am trying to run a report as per the below mssql query: $query = "SELECT tblWJCItem.AddedDescription, tblWJC.WJCPrefix, tblWJC.WJCNo, tblWJCItem.MaterialName, tblStockFamily.StockFamily, tblWJCItem.WeightToSend, tblWJC.DateCreated, tblWJC.WJCStatusID FROM tblWJC INNER JOIN tblCustomer ON tblWJC.CustomerID = tblCustomer.CustomerID INNER JOIN tblWJCStockStatus ON tblWJC.WJCStockStatusID = tblWJCStockStatus.WJCStockStatusID INNER JOIN tblStockStatus ON tblWJC.WJCID = tblStockStatus.WJCID LEFT OUTER JOIN tblWJCProductLine ON tblWJC.WJCID = tblWJCProductLine.WJCID LEFT OUTER JOIN tblWJCStockItem ON tblWJCProductLine.WJCProductLineID = tblWJCStockItem.tblWJCStockItem INNER JOIN tblStockFamily ON tblWJCItem.ProductFamilyID = tblStockFamily.StockFamilyID WHERE tblCustomer.CustomerName = 'NAME' AND tblWJCStockStatus.WJCStockStatus <> 'Stock Usage Confirmed' ORDER BY tblWJC.WJCID"; and then fetch the results by the following php code: $result = sqlsrv_query($conn, $query); while($row = sqlsrv_fetch_object($result)){ echo $row->AddedDescription .",".$row->WJCPrefix .",".$row->WJCNo.",".$row->MaterialName.",".$row->StockFamily.",".$row->WeightToSend.",".$row->DateCreated->format('d-m-Y').",".$row->WJCStatusID ."<br />"; } The connection to the database does get established but no results come through, i've got error reporting on in my php and the following message gets given: Warning: sqlsrv_fetch_object() expects parameter 1 to be resource, boolean given in C:\inetpub\wwwroot\kris\abs\test\rollsroyce.php on line 31 Line 31 is the while($row = sqlsrv_fetch_object($result)) Can anyone help with sorting this out its really starting to annoy me now. .
  8. Hello All, I'm trying to use PHP to post to MSSQL server, I can get a connection however when I attempt my MSSQL Statement the query just won't work. This is most troubling, anyone have any suggestions Here's my code $conn = mssql_connect( 'myServer', "username", 'password', 'database' ) or die('Error Connecting'); $sql = "INSERT INTO Employees (Area, isTicketRep) VALUES ('789456', '1')"; mssql_query($conn, $sql) or die('Error Querying MSSQL Database'); mssql_close($conn); I have tried an if statement to ensure a connection, I have a connection....however the query just wont execute. There are numerous column on my database table but I'm only submitted selected field. In addition the actual table is called "Employees" but on the server reads "dbo.Employees". My Database is called "cs_all" Just won't seem to query, thanks in advance for any suggestions
  9. Good morning, I am trying to convert a mssql query into json format so that I can then later pass this through google's visualisation api. The query and encoding seems to be working but the encode returns NULL. I have checked the normal gotcha's of making sure its utf8 encoded and that I have used a version of PHP that has the encode (using php 5.3.19). Can any one help me with getting the encode to work. PHP CODE: <?php //connection and database details (known to be working) if( $conn ) { echo "Connection established.<br><br>"; }else{ echo "Connection could not be established.<br />"; die( print_r( sqlsrv_errors(), true)); } $query = "SELECT * FROM tblProducts"; $result = sqlsrv_query( $conn, $query); while( $row = sqlsrv_fetch_array( $result, SQLSRV_FETCH_NUMERIC) ); $arr = array($result); $encodedarray = array_map(utf8_encode, $arr); echo json_encode($encodedarray); sqlsrv_close( $conn); ?> When I run this code on the server it comes back with: Connection established. [null] Has anyone got any ideas of getting this to work? Thanks Kris
  10. Hi, I have a Procedures ready to auto send email to employee when the reminder date equal today. Let me show you what is inside my employee database. As you can see, there is two records for employee 1001. This is because this employee short notice for 2 months. [sdate] There is also a shortNotice which is in December is 4 day, in January is 18 days. So, the consist days is 18+4=22 Days This is my procedure code, it's working, this procedure will trigger out email if meet the criteria. ***REMEMBER TO CHANGE THE SERVER NAME & PORT NUMBER*** USE [RSA] GO /****** Object: StoredProcedure [dbo].[sp_send_cdosysmail] Script Date: 12/10/2015 3:55:00 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[sp_send_cdosysmail] @From varchar(100)="notification@mail.com", @Subject varchar(100)="A Reminder for you", @body varchar(4000)=" ", @attachments varchar(4000)=NULL AS DECLARE @out_desc VARCHAR(1000), @out_mesg VARCHAR(10) DECLARE @empid nvarchar(255), @Name nvarchar(255), @Email nvarchar(255), @reminderDate datetime, @lastDay datetime, @shortNotice int, @consistsDays int, @sdate datetime Declare C1 CURSOR READ_ONLY FOR SELECT DISTINCT [empid],[Name],[Email],[reminderDate],[lastDay],[shortNotice],[consistsDays],[sdate] FROM [resigntblView] Declare @iMsg int Declare @hr int Declare @source varchar(255) Declare @description varchar(500) Declare @output varchar(1000) Declare @files table(fileid int identity(1,1),[file] varchar(255)) OPEN C1 FETCH NEXT FROM C1 INTO @empid,@Name, @Email, @reminderDate, @lastDay,@shortNotice,@consistsDays,@sdate WHILE @@FETCH_STATUS = 0 BEGIN IF DATEPART(DAY,@reminderDate) = DATEPART(DAY,GETDATE()) AND DATEPART(MONTH,@reminderDate) = DATEPART(MONTH,GETDATE()) AND DATEPART(YEAR,@reminderDate) = DATEPART(YEAR,GETDATE()) BEGIN SET @body = '<b>Hi ' + @Name + '</b><br />This is a reminder' + '<br /><br />Thank You' --************* Create the CDO.Message Object ************************ EXEC @hr = sp_OACreate 'CDO.Message', @iMsg OUT --***************Configuring the Message Object ****************** -- This is to configure a remote SMTP server. -- http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_schema_configuration_sendusing.asp EXEC @hr = sp_OASetProperty @iMsg, 'Configuration.fields ("http://schemas.microsoft.com/cdo/configuration/sendusing"). Value','2' -- This is to configure the Server Name or IP address. -- Replace MailServerName by the name or IP of your SMTP Server. EXEC @hr = sp_OASetProperty @iMsg, 'Configuration.fields ("http://schemas.microsoft.com/cdo/configuration/smtpserver"). Value', '#######' --PUT YOUR SERVER HERE -- Save the configurations to the message object. EXEC @hr = sp_OAMethod @iMsg, 'Configuration.Fields.Update', null -- Set the e-mail parameters. EXEC @hr = sp_OASetProperty @iMsg, 'To', @Email EXEC @hr = sp_OASetProperty @iMsg, 'From', @From EXEC @hr = sp_OASetProperty @iMsg, 'Subject', @Subject -- If you are using HTML e-mail, use 'HTMLBody' instead of 'TextBody'. EXEC @hr = sp_OASetProperty @iMsg, 'HTMLBody', @body EXEC @hr = sp_OAMethod @iMsg, 'Send' -- Do some error handling after each step if you need to. -- Clean up the objects created. EXEC @hr = sp_OADestroy @iMsg END FETCH NEXT FROM C1 INTO @empid,@Name, @Email, @reminderDate,@lastDay,@shortNotice,@consistsDays,@sdate END CLOSE C1 DEALLOCATE C1 Once the Procedures is execute, this is the OUTPUT that i received in my inbox: Hi Foo, Kelvin This is a reminder Thank You This Email will Trigger two times since there is a two column of data. My question is, how to merge some of the data in one, and send the email only once. Expected Output: Hi Foo, Kelvin, You are required to compensate USD 100 to the Company in view of your 22 days of short notice. The 1 month of your notice period consist of 22 working days, (01-12-2015 - 31-12-2015), 4 Days The 2 month of your notice period consist of 22 working days, (01-01-2016 - 31-01-2016), 18 Days Thank You. Thanks for your big help.
  11. Hello, I have a question regarding SQL. Please refer my attachment below: Query 1: SELECT dbo.[evaluation[Submit]]].FormID, dbo.empDB.Name, dbo.FormTbl.FormName, dbo.[evaluation[Submit]]].groupName, dbo.[evaluation[Submit]]].subGroup, dbo.subgrouptbl.subgroupName FROM dbo.[evaluation[Submit]]] INNER JOIN dbo.empDB ON dbo.[evaluation[Submit]]].EmpID = dbo.empDB.EmployeeID INNER JOIN dbo.FormTbl ON dbo.[evaluation[Submit]]].FormID = dbo.FormTbl.FormID INNER JOIN dbo.subgrouptbl ON dbo.[evaluation[Submit]]].subGroup = dbo.subgrouptbl.subgroupID WHERE (dbo.[evaluation[Submit]]].EmpID = '00001') This view of table give me correct of the output. Which give me 36 of results. Please refer attachment below: But, when i try to put additional table which i need to indicated whether the form is completed or draft, it's because i do not want to show "draft" form in the table. Have a look on the table below: After i added this table into my view, the output is repeated 2 times and give me 72 of results. Query 2: SELECT dbo.[evaluation[Submit]]].FormID, dbo.empDB.Name, dbo.FormTbl.FormName, dbo.[evaluation[Submit]]].groupName, dbo.[evaluation[Submit]]].subGroup, dbo.subgrouptbl.subgroupName, dbo.EmployeeDetails.submissionStatus FROM dbo.[evaluation[Submit]]] INNER JOIN dbo.empDB ON dbo.[evaluation[Submit]]].EmpID = dbo.empDB.EmployeeID INNER JOIN dbo.FormTbl ON dbo.[evaluation[Submit]]].FormID = dbo.FormTbl.FormID INNER JOIN dbo.subgrouptbl ON dbo.[evaluation[Submit]]].subGroup = dbo.subgrouptbl.subgroupID INNER JOIN dbo.EmployeeDetails ON dbo.empDB.EmployeeID = dbo.EmployeeDetails.EmpID WHERE (dbo.[evaluation[Submit]]].EmpID = '00001')
  12. I have a stored procedure that simply returns 1 result and only 1 row. The output when run through studio looks like the attached image. I have written local VB applications that execute the stored procedure and output the data on screen without issue. But when I use the below PHP app it acts as if though the stored procedure did not return any rows. All I get on the screen is the "Statement Executed" echo. Now other stored procedures work fine when I use this same code, but I know this SP is returning a row with a value (see attached screenshot) in it, so I can't understand why PHP would see only this SP as not returning a value. $connectionInfo = array( "UID"=>$uid, "PWD"=>$pwd, "Database"=>$databaseName); /* Connect using SQL Server Authentication. */ $conn = sqlsrv_connect( $serverName, $connectionInfo); $tsql = "Exec GetBalanceForBalanceSite '1008'"; /* Execute the query. */ $stmt = sqlsrv_query( $conn, $tsql); if ( $stmt ) { echo "Statement executed.<br>\n"; } else { echo "Error in statement execution.\n"; die( print_r( sqlsrv_errors(), true)); } /* Iterate through the result set printing a row of data upon each iteration.*/ while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC)) { echo $row[0]; }
  13. I need help changing the back ground color of a field. the below code sets the background color of my field to red(I have highlighted the code in red that does this.) What I want to do is change that color when the sql field WIP_master.uompScheduleColor changes.So i think I would want an if statement to do this but I am not sure where to start since the field I will be looking at is in the sql statment. WIP_master.uompScheduleColor data looks like this: CRIMSON NEON BLUE PINK SILVER GREEN YELLOW my code so far: <html> <head> <title>PHP SQL Test</title> </head> <body> <p> Status Screen </p> <?php $bgcolor="#FF0000"; $connect =odbc_connect("REMOVED"); if(!$connect) { exit("Connection Failed: " . $connect); } $sql=" SELECT distinct WIP_master.uompScheduleNumber,WIP_master.uompScheduleColor ,WIP_locations.location_name ,( SELECT COUNT(*) FROM OrbeData_KithKitchens.dbo.WIP_master WIP_master1 LEFT JOIN OrbeData_KithKitchens.dbo.WIP_locations WIP_locations1 ON WIP_master.location = WIP_locations1.location LEFT JOIN OrbeData_KithKitchens.dbo.WIP_status WIP_status1 ON WIP_master.STATUS = WIP_status1.STATUS WHERE WIP_master.uompScheduleNumber =WIP_master1.uompScheduleNumber and WIP_master1.status = '2' ) as Printed ,( SELECT COUNT(*) FROM OrbeData_KithKitchens.dbo.WIP_master WIP_master1 LEFT JOIN OrbeData_KithKitchens.dbo.WIP_locations WIP_locations1 ON WIP_master.location = WIP_locations1.location LEFT JOIN OrbeData_KithKitchens.dbo.WIP_status WIP_status1 ON WIP_master.STATUS = WIP_status1.STATUS WHERE WIP_master.uompScheduleNumber =WIP_master1.uompScheduleNumber and WIP_master1.status = '3' ) as Audited ,( SELECT COUNT(*) FROM OrbeData_KithKitchens.dbo.WIP_master WIP_master1 LEFT JOIN OrbeData_KithKitchens.dbo.WIP_locations WIP_locations1 ON WIP_master.location = WIP_locations1.location LEFT JOIN OrbeData_KithKitchens.dbo.WIP_status WIP_status1 ON WIP_master.STATUS = WIP_status1.STATUS WHERE WIP_master.uompScheduleNumber =WIP_master1.uompScheduleNumber and WIP_master1.status = '9' ) as Shortage ,( SELECT COUNT(*) FROM OrbeData_KithKitchens.dbo.WIP_master WIP_master1 LEFT JOIN OrbeData_KithKitchens.dbo.WIP_locations WIP_locations1 ON WIP_master.location = WIP_locations1.location LEFT JOIN OrbeData_KithKitchens.dbo.WIP_status WIP_status1 ON WIP_master.STATUS = WIP_status1.STATUS WHERE WIP_master.uompScheduleNumber =WIP_master1.uompScheduleNumber and WIP_master1.status = '10' ) as Shortage_Prt ,( SELECT COUNT(*) FROM OrbeData_KithKitchens.dbo.WIP_master WIP_master1 LEFT JOIN OrbeData_KithKitchens.dbo.WIP_locations WIP_locations1 ON WIP_master.location = WIP_locations1.location LEFT JOIN OrbeData_KithKitchens.dbo.WIP_status WIP_status1 ON WIP_master.STATUS = WIP_status1.STATUS WHERE WIP_master.uompScheduleNumber =WIP_master1.uompScheduleNumber and WIP_master1.status = '11' ) as Red ,( SELECT COUNT(*) FROM OrbeData_KithKitchens.dbo.WIP_master WIP_master1 LEFT JOIN OrbeData_KithKitchens.dbo.WIP_locations WIP_locations1 ON WIP_master.location = WIP_locations1.location LEFT JOIN OrbeData_KithKitchens.dbo.WIP_status WIP_status1 ON WIP_master.STATUS = WIP_status1.STATUS WHERE WIP_master.uompScheduleNumber =WIP_master1.uompScheduleNumber and WIP_master1.status = '12' ) as Neon ,( SELECT COUNT(*) FROM OrbeData_KithKitchens.dbo.WIP_master WIP_master1 LEFT JOIN OrbeData_KithKitchens.dbo.WIP_locations WIP_locations1 ON WIP_master.location = WIP_locations1.location LEFT JOIN OrbeData_KithKitchens.dbo.WIP_status WIP_status1 ON WIP_master.STATUS = WIP_status1.STATUS WHERE WIP_master.uompScheduleNumber =WIP_master1.uompScheduleNumber and WIP_master1.status = '20' ) as QC_Hold FROM OrbeData_KithKitchens.dbo.WIP_master WIP_master LEFT JOIN OrbeData_KithKitchens.dbo.WIP_locations ON WIP_master.location = WIP_locations.location LEFT JOIN OrbeData_KithKitchens.dbo.WIP_status WIP_status ON WIP_master.STATUS = WIP_status.STATUS order by WIP_master.uompScheduleNumber " ; $result =odbc_exec($connect,$sql); if(!$result){ exit("Error in SQL"); } echo "<table><tr>"; echo "<th>ScheduleNumber</th>"; echo "<th>Location</th>"; echo "<th>Printed</th>"; echo "<th>Audited</th>"; echo "<th>Shortage</th>"; echo "<th>Shortage_Prt</th>"; echo "<th>Red</th>"; echo "<th>Neon</th>"; echo "<th>QC_Hold</th>"; while (odbc_fetch_row($result)) { $uompScheduleNumber=odbc_result($result,"uompScheduleNumber"); $location_name=odbc_result($result,"location_name"); $Printed=odbc_result($result,"Printed"); $Audited=odbc_result($result,"Audited"); $Shortage=odbc_result($result,"Shortage"); $Shortage_Prt=odbc_result($result,"Shortage_Prt"); $Red=odbc_result($result,"Red"); $Neon=odbc_result($result,"Neon"); $QC_Hold=odbc_result($result,"QC_Hold"); echo "<tr><td bgcolor=$bgcolor >$uompScheduleNumber</td>"; echo "<td>$location_name</td>"; echo "<td>$Printed</td>"; echo "<td> $Audited</td>"; echo "<td> $Shortage</td>"; echo "<td> $Shortage_Prt</td>"; echo "<td> $Red</td>"; echo "<td> $Neon</td>"; echo "<td> $QC_Hold</td>"; } odbc_close($connect); ?> </body> </html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.