Results: 1022
INSERT statement
Inserts a single record into students table. In the
VALUES
clause we list the values in the same order as the columns are defined in the first clause
INSERT INTO `students` (
    `id`, 
    `first_name`, 
    `last_name`, 
    `points`, 
    `mail`, 
    `santa_id`
) 
VALUES (
    NULL, 
    'დავით', 
    'ბერიძე', 
    '54', 
    'david@gmail.com', 
    '10'
);
Inserts several rows with one INSERT statement
INSERT INTO `students` (
    `id`, 
    `first_name`, 
    `last_name`, 
    `points`, 
    `mail`, 
    `santa_id`
) 
VALUES 
	(NULL, 'დავით', 'ბერიძე', '54', 'david@gmail.com', '10'),
	(NULL, 'გელა', 'თავაძე', '54', 'david@gmail.com', '10'),
	(NULL, 'თამარ', 'დავითაშვილი', '54', 'david@gmail.com', '10')
;
We can exclude nullable fields and pass only the necessary fields
INSERT INTO `students` (
    `first_name`, 
    `last_name`, 
    `points`
) 
VALUES (
    'დავით', 
    'ბერიძე', 
    '54'
)
INSERT & SELECT statement
INSERT INTO `students` (`first_name`, `last_name`, `points`) 
SELECT first_name, last_name, points * 1.2 FROM students WHERE id = 3
We can use
sub-query
in INSERT statement. Before inserting the record,
sub-query
gets
gender_id
based on the provided gender name
INSERT INTO students (
    first_name, 
    last_name, 
    points,
    gender_id
) 
VALUES (
    'ილია', 
    'დავითაშვილი', 
    '84',
    (SELECT id FROM genders WHERE name = 'Male')
)
```
issues when upgrading MySQL from 5.5 to 8.0
Row with datetime value '0000-00-00 00:00:00' is not allowed
INSERT INTO `t_cal_mention` VALUES 
(1, 4, 1426, '0000-00-00 00:00:00', 0)
The insert query will produce the following MySQL error
Error Code: 1292. Incorrect datetime value: '0000-00-00 00:00:00' for column inserted_at at row 14
Row with date value '0000-00-00' is not allowed
INSERT INTO `t_design` VALUES (5,0,'წმ. დიდმოწამე მარინე','წმ. დიდმოწამე მარინე','წმ. დიდმოწამე მარინე','oi8io_104355.jpg','0000-00-00','')
The insert query will produce the following MySQL error
Error Code: 1292. Incorrect date value: '0000-00-00' for column 'date' at row 14
increase buffer size
The following issue:
...upstream sent too big header while reading response header from upstream...
Is fixed by adding these lines:
fastcgi_buffers 8 16k; # increase the buffer size for PHP-FTP
fastcgi_buffer_size 32k; # increase the buffer size for PHP-FTP
fastcgi_connect_timeout 60;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
To the site's configuration file:
server {
    listen 80;
    server_name pm.use.ge;
    root /var/www/pm.use.ge/public_html;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;

        include fastcgi_params;                                                                                                                                >        deny all;
    }
}
So that the final configuration file looks like this:
server {
    listen 80;
    server_name pm.use.ge;
    root /var/www/pm.use.ge/public_html;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;

        fastcgi_buffers 8 16k; # increase the buffer size for PHP-FTP
        fastcgi_buffer_size 32k; # increase the buffer size for PHP-FTP
        fastcgi_connect_timeout 60;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;

        include fastcgi_params;                                                                                                                                >        deny all;
    }
}
check that the response JSON text is equal to the specified text
Tests that the response JSON is equal to the specified text
pm.test("Body is correct", function () {
    pm.response.to.have.body('{"status":{"code":400,"text":"Mobile Number is required"}}');
});
The response JSON
{
    "status": {
        "code": 400,
        "text": "Mobile Number is required"
    }
}
The test returns
true
because the text passed to the test is the same as the response JSON
check if the response JSON includes certain text
Tests that the response JSON includes text:
Mobile Number
pm.test("Body matches string", function () {
    pm.expect(pm.response.text()).to.include("Mobile Number");
});
The response JSON
{
    "status": {
        "code": 400,
        "text": "Mobile Number is required"
    }
}
The command below makes Git
forget
about
test.php
that was tracked but is now in
.gitignore
git rm --cached test.php
The command makes Git
forget
about all files under
docs
directory that was tracked but is now in
.gitignore
git rm -r --cached docs/
enable db connection to another server
View settings:
getsebool -a | grep httpd
Setting to enable to connect to FB to another server:
setsebool -P httpd_can_network_connect_db 1
The example below parses an XML document
address.xml
into an XML DOM object. Then extracts
contact
information using
JavaScript
<!DOCTYPE html>
<html>
   <body>
      <h1>TutorialsPoint DOM example </h1>
      <div>
         <b>Name:</b> <span id = "name"></span><br>
         <b>Company:</b> <span id = "company"></span><br>
         <b>Phone:</b> <span id = "phone"></span>
      </div>
      <script>
         if (window.XMLHttpRequest)
         {// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp = new XMLHttpRequest();
         }
        //  else
        //  {// code for IE6, IE5
        //     xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        //  }
         xmlhttp.open("GET","address.xml",false);
         xmlhttp.send();
         xmlDoc = xmlhttp.responseXML;

         document.getElementById("name").innerHTML = xmlDoc.getElementsByTagName("name")[0].childNodes[0].nodeValue;
         document.getElementById("company").innerHTML = xmlDoc.getElementsByTagName("company")[0].childNodes[0].nodeValue;
         document.getElementById("phone").innerHTML = xmlDoc.getElementsByTagName("phone")[0].childNodes[0].nodeValue;
      </script>
   </body>
</html>
address.xml
file content
<?xml version = "1.0"?>
<contact>
   <name>Tanmay Patil</name>
   <company>TutorialsPoint</company>
   <phone>(011) 123-4567</phone>
</contact>
JSON data - create and fill <select> using "createElement" method CODE
Creates
<select>
element using
document.createElement
method and fills with JSON array
optionArray = [
    "daily",
    "weekly",
    "biweekly",
    "monthly"
];

// Creates <select> element
let selector = document.createElement('select');

for(let option in optionArray) {
    let value = optionArray[option];
  
    // Creates <option> element for <select>
    let newOption = document.createElement("option"); 
    
    newOption.value = value;
    newOption.innerHTML = value;
  
    selector.options.add(newOption);
}
// Adds the <select> element into the document object
document.body.appendChild(selector);
JS script below creates
<script>
element and fills with the
JSON
retrieved from a server
<script>

var obj, dbParam, xmlhttp, myObj, x, txt = "";
obj = { table: "customers", limit: 20 };
dbParam = JSON.stringify(obj);
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
  if (this.readyState == 4 && this.status == 200) {
    myObj = JSON.parse(this.responseText);
    txt += "<select>"
    for (x in myObj) {
      txt += "<option>" + myObj[x].name;
    }
    txt += "</select>"
    document.write(txt);
  }
};
xmlhttp.open("POST", "json_demo_html_table.php", true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.send("x=" + dbParam);

</script>
Results: 1022