var cell1_html = "<span id='"+e_type_cell_id(row_id)+"'>"; // We have to call different php based on new_data. // But we can't actually pass the javascript var to php. // The only way is to branch in javascript and call different php. // This means we end up calling the query twice. Oh well, it's the only way. if ( new_data ) { cell1_html = cell1_html+"<?php types_dropdown_as_innerHTML($mysqli, 0, e_types_query($user_id), "e_temp_dropdown", 1); ?> "; } else { cell1_html = cell1_html+"<?php types_dropdown_as_innerHTML($mysqli, 0, e_types_query($user_id), "e_temp_dropdown", 0); ?> "; } cell1_html = cell1_html + "</span>"; cell1.innerHTML=cell1_html; // Now reset the ID. document.getElementById('e_temp_dropdown').id = e_type_id(row_id); } return add_row; } function e_changeType(selector, new_data, update_data) {
// =================================================================== case 3: // DATABASE QUERY require_once './mysql_connect.php'; if (!isset($_GET['table']) || !isset($_GET['user_id']) || !isset($_GET['type_dom_id'])) { echo "Invalid parameters for AJAX query 3..."; $mysqli->close(); exit; } $table = (int) $_GET['table']; $user_id = (int) $_GET['user_id']; $type_dom_id = $_GET['type_dom_id']; // Make sure we set the $user_id string before including this. require_once './queries.php'; if ($table == "0") { $query_types = e_types_query($user_id); } else { $query_types = f_types_query($user_id); } // We call a shared function to accomplish this one. require_once './shared_functions.php'; types_dropdown_as_innerHTML($mysqli, $table, $query_types, $type_dom_id, 1); $mysqli->close(); exit; // =================================================================== // Add the log row for which we just received all the data // to the database... // =================================================================== // =================================================================== // Add the log row for which we just received all the data // to the database...