Jump to content

Ty44ler

Members
  • Posts

    133
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Ty44ler's Achievements

Member

Member (2/5)

0

Reputation

  1. Background: I work on an application that tracks server information. The data comes from 10 tables in a database that are exact replicas of 10 CSV files that insert daily into their specific tables. The database is nowhere near normalized and is a straight dump from the CSV to the db tables. (CSV headers match the table fields) Problem: I need to figure out a way to get the data from the CSV data into a normalized database for the application to read instead of a straight dump of the CSV data to the table. I have little control over the CSV's, but do have control over what happens with them afterwards. What would be the best way to get logical data into a normalized database from a set of CSV's? Thanks!
  2. Solved: foreach ($tasks as $task) { $task_list[$task['sr_id']]['task_id'][$task['sr_fe_task_id']] = array(); $task_list[$task['sr_id']]['task_id'][$task['sr_fe_task_id']]['due_date'] = $task['due_date']; $task_list[$task['sr_id']]['task_id'][$task['sr_fe_task_id']]['description'] = $task['description']; }
  3. I have a 1 dimensional array from a database output that I need to have in a multidimensional array ($tasks): array 0 => array 'sr_id' => string '4902367' (length=7) 'description' => string 'GLS Jersey Mikes Installation Checklist' (length=39) 'due_date' => string '2012-01-07 23:24:00' (length=19) 'sr_fe_task_id' => string '220958' (length=6) 1 => array 'sr_id' => string '4902367' (length=7) 'description' => string 'Please submit your pictures of the installation area before any work was performed.' (length=83) 'due_date' => string '2012-01-07 23:24:00' (length=19) 'sr_fe_task_id' => string '220959' (length=6) 2 => array 'sr_id' => string '4902367' (length=7) 'description' => string 'Please submit your pictures of the installation area after all work was completed.' (length=82) 'due_date' => string '2012-01-07 23:24:00' (length=19) 'sr_fe_task_id' => string '220960' (length=6) 3 => array 'sr_id' => string '4903303' (length=7) 'description' => string 'Upload pictures of colored patch cables connected to back of router.' (length=116) 'due_date' => string '2012-01-07 23:31:00' (length=19) 'sr_fe_task_id' => string '220961' (length=6) 4 => array 'sr_id' => string '4899664' (length=7) 'description' => string 'Please upload all pictures taken on site.' (length=41) 'due_date' => string '2012-01-17 17:33:00' (length=19) 'sr_fe_task_id' => string '222839' (length=6) Each sr_id may have more than one task under it and each task has a due_date and description under it, but I'm having trouble getting the descriptions and due_dates under each task: ['sr_id'] =>4902367 ['sr_fe_task_id'] => 220958 ['description']=> "GLS Jersey Mikes Installation Checklist" ['due_date']=> '2011-12-08 17:50:00' ['sr_fe_task_id'] => 220959 ['description']=> "Pleease submit your pictures of the installation area." ['due_date']=> '2012-01-07 23:24:00' ['sr_id'] =>4903303 ['sr_fe_task_id'] => 220961 ['description']=> "Upload pictures of colored patch cables connected to back of router." ['due_date']=> '2012-01-07 23:31:00' I've got it to where each sr_id is listed along with all the tasks underneath of them, but can't get it to where each task has the description and due date under it: for ($i=0; $i<COUNT($tasks); $i++){ $task_list[$tasks[$i]['sr_id']]['task_id'][$tasks[$i]['sr_fe_task_id']] =$tasks[$i]['sr_fe_task_id']; foreach ($task_list[$tasks[$i]['sr_id']]['task_id'] as $v){ $task_list[$tasks[$i]['sr_id']]['task_id'][$v][$tasks[$i]['due_date']]; } }
  4. Those are good answers. I already have a standard include file for the site so I may go that route since it's already halfway in place. I'm not actually selling pens. It's actually a sort of directory for technicians to sign up looking for jobs, but for different technicians. I just thought the red vs blue would be a simpler analogy. One more question, how would I deal with upper and lower case values? Some would need to be upper case, while others would be lower case?
  5. I have two domains. I'd like to replace a word depending on the URL the user has typed in. For example: Original site is all about red pens. Well I want to make another domain that is bluepens.com, but when they enter in bluepens.com it uses the same pages from red pens except wherever the word 'red' is found it is changed to blue pens making it a whole new site. I know I can use str_replace() for certain instances, but how would you do it for an entire website using the url? Thanks!
  6. Trying to get some videos to play on my site, but they don't work on older IE browsers. I think it has something to do with HTML5 that's in there, but the backup flash file isn't being played either so I'm not sure. Here's my PHP: private function createVideoHTML($intVersion) { $strHTML = ""; if (is_int($intVersion)) { if ($intVersion >= 0 && $intVersion < $this->intImageCount ) { $intWidth = $this->arrVersions[$intVersion]["width"]; $intHeight = $this->arrVersions[$intVersion]["height"]; $strFlashSrc = $this->arrVersions[$intVersion]["flash_src"]; $strHTML = " <video width=\"$intWidth\" height=\"$intHeight\" controls>\n"; foreach($this->arrVersions[$intVersion]["video_array"] as $intKey => $strVideo) { $strSrc = $strVideo["src"]; $strType = $strVideo["type"]; $strCodecs = $strVideo["codecs"]; $strHTML .= " <source src=\"$strSrc\" type=\"$strType\" codecs=\"$strCodecs\">\n"; } if (strlen($strFlashSrc) > 0) { $strHTML .= $this->createFlashHTML($strFlashSrc, $intVersion); } $strHTML .= " </video>\n\n"; } } return $strHTML; } Outputted HTML: <div id="video"> <video width="640" height="360" controls> <source src="assets/company_reel/company_reel.iphone.mp4" type="video/mp4" codecs="avc1.42E01E, mp4a.40.2"> <source src="assets/company_reel/company_reel.webm" type="video/webm" codecs="vp8, vorbis"> <source src="assets/company_reel/company_reel.theora.ogv" type="video/ogg" codecs="theora, vorbis"> <object width="320" height="240" type="application/x-shockwave-flash" data="assets/company_reel/company_reel.flv"> <param name="movie" value="assets/company_reel/company_reel.flv" /> <param name="allowfullscreen" value="true" /> </object> </video> Thanks in advance!
  7. Can anyone tell me why the words are stacked on top of each other below the picture? It's only on FF. http://www.standoffstudios.com/ Thanks for your help!
  8. I'm trying to get a listing of my directory that shows the first letter and then all the names that start with that letter. Here is my code: for($i = 65; $i < 91; $i++) { foreach (glob("{".chr($i).",".chr($i+32)."}*", GLOB_BRACE|GLOB_ONLYDIR) as $directoryname) { echo chr($i)."| ".$directoryname; } } But here's my output: I want it to be like: I know I have to move the chr($i) since it loops, but I'm not sure where to go from there.
  9. That worked! Thank you so much!
  10. I'm trying to sort this dropdown box. It reads from a directory, and lists the file name in the dropdown box. Here's the tricky part... the filename is listed differently in the dropdown than in the directory by using explode(). I want to sort it though since it's still being sorted by the directory listings... For example: Filename starts out as: 123_abc_567.pdf then gets listed as abc_123_567.pdf in the dropdown, but it's still getting sorted as if it were 123_abc_567.pdf How can I do that? Here's my code: // Define the full path to folder from root $path = "C:/Work_Orders/"; // Open the folder $dir_handle = @opendir($path) or die("Unable to open $path"); echo "<form method=\"POST\" action='".$_SERVER['PHP_SELF']."' name='selectworkorder'><select name='ordernumber2'>"; // Loop through the files while ($file = readdir($dir_handle)) { //Remove file extension $ext = strrchr($file, '.'); if($ext !== false) { $file = substr($file, 0, -strlen($ext)); } if($file == "." || $file == ".." || $file == "index.php" ) continue;//explode file name $changedordernumber = explode("_",$file);//put in new order$changedordernumber = $changedordernumber[1]."_".$changedordernumber[0]."_".$changedordernumber[2]; $changedordernumber=trim($changedordernumber,"_"); //list optionsecho "<option name='$file' value='$file'>$changedordernumber</option>\n"; } echo "</select><input type='submit' value='Change' name='submit'/></form></div>"; // Close closedir($dir_handle);
  11. I have a list of job numbers with data associated with it that is discovered through a SOAP call. I can't seem to get certain job numbers to return data even though there is data associated with it. I did a var_dump and can see the data associated it so there is definitely data there, but it will only return 5 blank spaces. Here's my code: $jobnumber = "000037"; $subjobnumber = "KES"; $client = new SoapClient("http://refrigerantcompliance/RefrigerantComplianceService/Service1.asmx?wsdl", array('cache_wsdl' => 0, 'trace' => 1)); $result = $client->GetWorkOrders(array("jobNumber" => "$jobnumber", 'subJobNumber' => "$subjobnumber")); $orders = $result->GetWorkOrdersResult->WorkOrderDAO; print "<select name='SRTicket'><option>Please Select One</option>"; foreach($orders as $k=>$v){ print "<option value=\"".$v->RequestNo."\">".$v->RequestNo."_".$v->Description."</option>"; } print "</select><br />"; echo "<pre>"; var_dump($orders); echo "</pre>"; ?> Here's the data from var_dump: object(stdClass)#918 (7) { ["StatusCode"]=> string(1) "A" ["SRPWOHRID"]=> int(5204) ["CompanyNumber"]=> int(30) ["DivisionNumber"]=> int(0) ["CustomerNumber"]=> int(37) ["RequestNo"]=> int(3363) ["Description"]=> string(50) "KESSLER ELEMENTARY SCHOOL - CHILLER DOWN " } I've attached a screenshot with the blanks in the dropdown and the data from the var_dump Thanks for your help in advance! [attachment deleted by admin]
  12. Got it figured out. Thanks for your help Gizmola! $client = new SoapClient("http://refrigerantcompliance/RefrigerantComplianceService/Service1.asmx?wsdl", array('cache_wsdl' => 0, 'trace' => 1)); $result = $client->GetWorkOrders(array("customerNumber" => "31150")); $orders = $result->GetWorkOrdersResult->WorkOrderDAO; print "<select name='workorder'><option>Please Select One</option>"; foreach($orders as $k=>$v){ print "<option value=\"".$v->SRPWOHRID."\">".$v->SRPWOHRID." - ".$v->Description."</option>"; } print "</select><br />";
  13. stdClass Object ( ) object(stdClass)#1 (1) { ["GetWorkOrdersResult"]=> object(stdClass)#3 (0) { } }
  14. I was mistaken, this is the WSDL file: <wsdl:definitions targetNamespace="http://tempuri.org/"> − <wsdl:types> − <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/"> − <s:element name="HelloWorld"> <s:complexType/> </s:element> − <s:element name="HelloWorldResponse"> − <s:complexType> − <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="HelloWorldResult" type="s:string"/> </s:sequence> </s:complexType> </s:element> − <s:element name="GetCustomers"> <s:complexType/> </s:element> − <s:element name="GetCustomersResponse"> − <s:complexType> − <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="GetCustomersResult" type="tns:ArrayOfCustomerDAO"/> </s:sequence> </s:complexType> </s:element> − <s:complexType name="ArrayOfCustomerDAO"> − <s:sequence> <s:element minOccurs="0" maxOccurs="unbounded" name="CustomerDAO" nillable="true" type="tns:CustomerDAO"/> </s:sequence> </s:complexType> − <s:complexType name="CustomerDAO"> − <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="StatusCode" type="s:string"/> <s:element minOccurs="1" maxOccurs="1" name="CompanyNumber" type="s:int"/> <s:element minOccurs="1" maxOccurs="1" name="DivisionNumber" type="s:int"/> <s:element minOccurs="1" maxOccurs="1" name="CustomerNumber" type="s:int"/> <s:element minOccurs="0" maxOccurs="1" name="CustomerName" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="Address1" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="Address2" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="City" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="StateCode" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="ZipCode" type="s:string"/> </s:sequence> </s:complexType> − <s:element name="GetWorkOrders"> − <s:complexType> − <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="customerNumber" type="s:string"/> </s:sequence> </s:complexType> </s:element> − <s:element name="GetWorkOrdersResponse"> − <s:complexType> − <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="GetWorkOrdersResult" type="tns:ArrayOfWorkOrderDAO"/> </s:sequence> </s:complexType> </s:element> − <s:complexType name="ArrayOfWorkOrderDAO"> − <s:sequence> <s:element minOccurs="0" maxOccurs="unbounded" name="WorkOrderDAO" nillable="true" type="tns:WorkOrderDAO"/> </s:sequence> </s:complexType> − <s:complexType name="WorkOrderDAO"> − <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="StatusCode" type="s:string"/> <s:element minOccurs="1" maxOccurs="1" name="SRPWOHRID" type="s:int"/> <s:element minOccurs="1" maxOccurs="1" name="CompanyNumber" type="s:int"/> <s:element minOccurs="1" maxOccurs="1" name="DivisionNumber" type="s:int"/> <s:element minOccurs="1" maxOccurs="1" name="CustomerNumber" type="s:int"/> <s:element minOccurs="1" maxOccurs="1" name="RequestNo" type="s:int"/> <s:element minOccurs="0" maxOccurs="1" name="RequestorName" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="AreaCode" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="PhoneNo" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="Address1" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="Address2" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="City" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="StateCode" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="ZipCode" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="RequestType" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="CustomerPONumber" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="Description" type="s:string"/> </s:sequence> </s:complexType> </s:schema> </wsdl:types> − <wsdl:message name="HelloWorldSoapIn"> <wsdl:part name="parameters" element="tns:HelloWorld"/> </wsdl:message> − <wsdl:message name="HelloWorldSoapOut"> <wsdl:part name="parameters" element="tns:HelloWorldResponse"/> </wsdl:message> − <wsdl:message name="GetCustomersSoapIn"> <wsdl:part name="parameters" element="tns:GetCustomers"/> </wsdl:message> − <wsdl:message name="GetCustomersSoapOut"> <wsdl:part name="parameters" element="tns:GetCustomersResponse"/> </wsdl:message> − <wsdl:message name="GetWorkOrdersSoapIn"> <wsdl:part name="parameters" element="tns:GetWorkOrders"/> </wsdl:message> − <wsdl:message name="GetWorkOrdersSoapOut"> <wsdl:part name="parameters" element="tns:GetWorkOrdersResponse"/> </wsdl:message> − <wsdl:portType name="Service1Soap"> − <wsdl:operation name="HelloWorld"> <wsdl:input message="tns:HelloWorldSoapIn"/> <wsdl:output message="tns:HelloWorldSoapOut"/> </wsdl:operation> − <wsdl:operation name="GetCustomers"> <wsdl:input message="tns:GetCustomersSoapIn"/> <wsdl:output message="tns:GetCustomersSoapOut"/> </wsdl:operation> − <wsdl:operation name="GetWorkOrders"> <wsdl:input message="tns:GetWorkOrdersSoapIn"/> <wsdl:output message="tns:GetWorkOrdersSoapOut"/> </wsdl:operation> </wsdl:portType> − <wsdl:binding name="Service1Soap" type="tns:Service1Soap"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/> − <wsdl:operation name="HelloWorld"> <soap:operation soapAction="http://tempuri.org/HelloWorld" style="document"/> − <wsdl:input> <soap:body use="literal"/> </wsdl:input> − <wsdl:output> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> − <wsdl:operation name="GetCustomers"> <soap:operation soapAction="http://tempuri.org/GetCustomers" style="document"/> − <wsdl:input> <soap:body use="literal"/> </wsdl:input> − <wsdl:output> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> − <wsdl:operation name="GetWorkOrders"> <soap:operation soapAction="http://tempuri.org/GetWorkOrders" style="document"/> − <wsdl:input> <soap:body use="literal"/> </wsdl:input> − <wsdl:output> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> − <wsdl:binding name="Service1Soap12" type="tns:Service1Soap"> <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/> − <wsdl:operation name="HelloWorld"> <soap12:operation soapAction="http://tempuri.org/HelloWorld" style="document"/> − <wsdl:input> <soap12:body use="literal"/> </wsdl:input> − <wsdl:output> <soap12:body use="literal"/> </wsdl:output> </wsdl:operation> − <wsdl:operation name="GetCustomers"> <soap12:operation soapAction="http://tempuri.org/GetCustomers" style="document"/> − <wsdl:input> <soap12:body use="literal"/> </wsdl:input> − <wsdl:output> <soap12:body use="literal"/> </wsdl:output> </wsdl:operation> − <wsdl:operation name="GetWorkOrders"> <soap12:operation soapAction="http://tempuri.org/GetWorkOrders" style="document"/> − <wsdl:input> <soap12:body use="literal"/> </wsdl:input> − <wsdl:output> <soap12:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> − <wsdl:service name="Service1"> − <wsdl:port name="Service1Soap" binding="tns:Service1Soap"> <soap:address location="http://refrigerantcompliance/RefrigerantComplianceService/Service1.asmx"/> </wsdl:port> − <wsdl:port name="Service1Soap12" binding="tns:Service1Soap12"> <soap12:address location="http://refrigerantcompliance/RefrigerantComplianceService/Service1.asmx"/> </wsdl:port> </wsdl:service> </wsdl:definitions> The other was the asmx web page that the GetWorkOrder function has.
  15. print_r($result): stdClass Object ( [GetWorkOrdersResult] => stdClass Object ( ) )
×
×
  • 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.