Jump to content

Plugnz13

New Members
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Plugnz13

  • Rank
    Newbie
  1. Hi All, Sorry to be a pain, but further to the above query, which worked wonders by the way, i now have extended it to select the data based on three situations happening. Basically I want to select the job name and id by the staff member that is assigned to a specific task but only if the state of the job equals that task. echo "<div id='col_3' class='bg-white col-sm-1 border'>"; $jobs_2 = $xml->xpath("Jobs/Job[State= 'Model Drawing' and Type= '$Category' or State= 'Model Drawing' and Tasks/Task/Assigned/Staff/Name= '$Staff' and Tasks/Task/Name= 'Model Drawing']"); foreach($jobs_2 as $item) { $job_no = "$item->ID"; $job_name = "$item->Name"; echo "<button type='button' class='btn btn-outline-light waves-effect'><a href='activecp/managejob.php?job_id=$job_no'><strong>$job_no</strong><br> $job_name</a></button>"; } ignore the part before "or" as that's all good. So I'd like to show the job name where the Job State is"Model Drawing' but only if Staff "Member 1" is assigned to the task "Model Drawing". So it is working except that if Staff "Member2" is assigned to a later task (that doesn't match the state task) the job name also shows up on their page even though they are not assigned to that task. Hope that makes sense? Thanks again in advance.
  2. Thanks Phil, That is a super easy fix! much appreciated!
  3. Hi All, I've been struggling to get the following code to work. I have an API feed that looks like this: <Jobs> <Job> <ID>1805</ID> <Name>House Additions/Alterations </Name> <Description>House</Description> <Client> <ID>16178470</ID> <Name>client name 1</Name> </Client> <ClientOrderNumber></ClientOrderNumber> <State>In Construction</State> <StartDate>2018-03-26T00:00:00</StartDate> <DueDate>2020-03-31T00:00:00</DueDate> <Contact> <ID>10195532</ID> <Name>Clent Name1</Name> </Contact> <InternalID>25026686</InternalID> <Manager> <ID>610781</ID> <Name>Manager Name 1</Name> </Manager> <Partner> <ID>610781</ID> <Name>patner name</Name> </Partner> <Assigned> <Staff> <ID>610781</ID> <Name>Staff 1</Name> </Staff> ......... I'm trying to work out how to show all the job ID, Job Name, Client Name, Start Date etc that are specific to the assigned staff member by selecting a specific staff member. $Staff is populated by a dropdown earlier in the code. here's my code so far: if ($err) { echo "cURL Error #:" . $err; } else { $xml=simplexml_load_string($response) or die("Error: Cannot create object"); $jobs = $xml->xpath("Jobs/Job/Assigned/Staff[Name= '$Staff']"); foreach($jobs as $item) { //foreach($xml->Jobs->Job as $item) { $item1 = $item->Client->Name; $job_no = "$item->ID"; $job_name = "$item->Name"; $job_client = "$item1"; $job_start = "$item->StartDate"; $job_due = "$item->DueDate"; $job_status = "$item->State"; echo "<tr><td>$job_no</td><td><a href='activecp/managejob.php?job_id=$job_no'>$job_name</a></td><td>$job_client</td><td>$job_status</td><td>$job_start</td><td>$job_due</td></tr>"; } } This currently shows the ID and name of the selected staff member but not the info i need. All of the data I want to show is before the Assigned/Staff . Any help would be much appreciated. Thanks in advance.
×
×
  • 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.