<commit_before><?php
/*
 * Update Tool Room Equipment List
 * 
 */

// Database info
require_once('db.php');
 
// Validate user input
require_once('util/test_input.php');

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $db = new mysqli($db_host, $db_user, $db_pass, $db_name);

    if ($db->connect_errno == 0) {
        //echo '<p>Connection to MySQL server successfully established.</p >';
        
        // validate & store input
        $count = test_input($_POST['Count']);
        $item = test_input($_POST['Item']);
        
        // update query
        $UpdateQuery = sprintf("INSERT INTO `ToolRoomEquipment`(`count`, `name`) VALUES (%s, %s)",
            $db->real_escape_string($count), $db->real_escape_string($item));
        
        // execute query
        $db->query($UpdateQuery) or die($db->error);
        
        // redirect user back to admin page
        header("Location: https://therogersmanufacturingcompany.com/admin/");
    }
}
?><commit_msg>fix tool room update query<commit_after><?php
/*
 * Update Tool Room Equipment List
 * 
 */

// Database info
require_once('db.php');
 
// Validate user input
require_once('util/test_input.php');

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $db = new mysqli($db_host, $db_user, $db_pass, $db_name);

    if ($db->connect_errno == 0) {
        //echo '<p>Connection to MySQL server successfully established.</p >';
        
        // validate & store input
        $count = test_input($_POST['Count']);
        $item = test_input($_POST['Item']);
        
        // update query
        $UpdateQuery = sprintf("INSERT INTO `ToolRoomEquipment`(`count`, `name`) VALUES (%d, '%s')",
            intval($count), $db->real_escape_string($item));
        
        // execute query
        $db->query($UpdateQuery) or die($db->error);
        
        // redirect user back to admin page
        header("Location: https://therogersmanufacturingcompany.com/admin/");
    }
}
?>
{'fraction_non_alphanumeric': 0.16666666666666666, 'fraction_numerical': 0.0010256410256410256, 'mean_word_length': 2.639925373134328, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 18, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '228369', 'n_tokens_mistral': 592, 'n_tokens_neox': 577, 'n_words': 132}