include ("connectDB.php");
$conn = get_db_connection();
...
$query = "SELECT kpID FROM movie where kpID=".$id." limit 1";
$result = $conn->query($query);
$row = $result->fetch_assoc();
...
function dosomething() {
$query = "SELECT kpID FROM movie where kpID=".$id." limit 1";
$result = $conn->query($query);
$row = $result->fetch_assoc();
}
dosomething();
global $conn;
в начале функции dosomething. <a data-id="123">link</a>
$(this).data("id") // returns 123
$(this).attr("data-id", "321"); //change the attribute
$(this).data("id") // STILL returns 123!!!
$(this).data("id", "321")
$(this).data("id") // NOW we have 321