Right now I'm currently attempting to make a MySQLi class to make typing code easier and so it looks cleaner and is more usable overall.
I'm attempting to write a function which will execute a query with a prepared statement. My dilemma is this:
public function safeRead($query, $data, $params)
{
$stmt = $mysqli->prepare($query);
$stmt->bind_param($params, $data);
$stmt->execute();
$result = $stmt->get_result();
$check = $result->fetch_assoc();
}
I of course want to execute a query, as you can see. My problem lies with the $data variable. How can I/is it possible to pass data, as a string and possibly convert to an array or something usable so it can be used with bind_param ?