I'm working on a project, I decided to use a function to select,... from db ,
my question is, Is using a function like this function safe to use?
if not do you have any better idea?
function selectFromDB($tbl,$id) {
include("connect.php");
$sql = "SELECT * FROM ".$tbl." WHERE ID = '$id'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$GLOBALS['selectFromDB'] = $row;
}
}
}