sábado, 12 de octubre de 2024

filter array if value is >=70

 <?php

function pass($var){

    

  return $var>=70;

    

}


$notas=array("Jose"=>90,"Ambiorix"=>100,"Maria"=>65,90);

print_r(array_filter($notas,"pass"));


?>


Array

(

    [Jose] => 90

    [Ambiorix] => 100

    [0] => 90

)


domingo, 6 de octubre de 2024

MYSQL TRIGGERS EXAMPLE

 DELIMITER //


CREATE TRIGGER ProductSellPriceUpdateCheck 

    AFTER UPDATE  

    ON Products FOR EACH ROW  

BEGIN

IF NEW.SellPrice <= NEW.BuyPrice THEN

INSERT INTO Notifications(Notification,DateTime) 

VALUES(CONCAT(NEW.ProductID,' was updated with a SellPrice of ', NEW.SellPrice,' which is the same or less than the BuyPrice'), NOW()); 

    END IF;

END //




DELIMITER //


CREATE TRIGGER ProductSellPriceInsertCheck 

    AFTER INSERT  

    ON Products FOR EACH ROW  

BEGIN

IF NEW.SellPrice <= NEW.BuyPrice THEN

INSERT INTO Notifications(Notification,DateTime) 

VALUES(CONCAT('A SellPrice same or less than the BuyPrice was inserted for ProductID ', NEW.ProductID), NOW()); 

    END IF;

END //



DELIMITER //


CREATE TRIGGER NotifyProductDelete 

    AFTER DELETE   

    ON Products FOR EACH ROW   

INSERT INTO Notifications(Notification, DateTime) 

    VALUES(CONCAT('The product with a ProductID ', OLD.ProductID,' was deleted'), NOW()); 

END //

DELIMITER ;

sábado, 5 de octubre de 2024

MySQl official Guide

 https://dev.mysql.com/doc/refman/8.4/en/

https://developers.facebook.com/docs/pages-api/comments-mentions/

Get comments

To get the comments for a Page post, send a GET request to the /page_post_id/comments endpoint with the fields parameter set to a comma-separated list that includes the message field, to get the content for the comment and the from field, to get the Page-scoped ID (PSID) for the person or Page who commented on the post, if you would like to @mention the person or Page in the comment.

Example Request

Formatted for readability. Replace bold, italics values, such as page_post_id, with your values.
curl -i -X GET "https://graph.facebook.com/page_post_id/comments?fields=from,message"

On success, your app receives the following JSON response with the commentor's name, PSID, message and the comment ID:

{
  "data": [
    {
      "created_time": "2020-02-19T23:05:53+0000",
      "from": {
        "name": "commentor_name",
        "id": "commentor_PSID"
      },
      "message": "comment_content",
     "id": "comment_id"
    }
  ],
  "paging": {
    "cursors": {
      "before": "MQZDZD",
      "after": "MQZDZD"
    }
  } 

}  

https://developers.facebook.com/docs/pages-api/comments-mentions/