Hello everywhere,
In my database, I have add two columns, the first one is “Notes” and the second “Annotation” (I’m French) in tables “hardware”. The columns “Notes” make the status of the PC (storage, production or broke) and the columns “Annotation”, a little describe of the user (Maintenance Office).
I’m wrote two request.
First request (for the columns “Notes”):
UPDATE hardware
LEFT JOIN itmgmt_comments on itmgmt_comments.HARDWARE_ID=hardware.ID
SET hardware.Notes=itmgmt_comments.COMMENTS
WHERE hardware.ID=itmgmt_comments.HARDWARE_ID and itmgmt_comments.COMMENTS
LIKE ('%en stock%') or itmgmt_comments.COMMENTS LIKE ('%en prod%') or itmgmt_comments.COMMENTS LIKE ('%a broke%');
Second request (for the columns “Annotations”):
UPDATE hardware
LEFT JOIN itmgmt_comments on itmgmt_comments.HARDWARE_ID=hardware.ID
SET hardware.Annotations=itmgmt_comments.COMMENTS
WHERE hardware.ID=itmgmt_comments.HARDWARE_ID and itmgmt_comments.COMMENTS
NOT LIKE ('%en stock%') or itmgmt_comments.COMMENTS NOT LIKE ('%en prod%') or itmgmt_comments.COMMENTS NOT LIKE ('%a broke%');
The request is work when in I’m directly connect on the database, but now I want create program in php, when you click on the button “OK”, the OCS inventory create the comments in the dashboard and he add the comments in the columns "Notes" or "Annotations" in view "machine Windows".
Can you help or give a example for the request sql with php?
Best regards
Materials : Server: Ubuntu 18.04, Ocsreports 2.8.1