If I search for a string directly it works properly but whenever I store that string in a variable and try to search that it gives me:
bool(false)
here is my code
<?php
$mysqli = new mysqli("localhost", "root", "password", "database");
$roll_no='9999-SO-12';
echo $roll_no;
$res = $mysqli->query("SELECT name,title FROM student_data WHERE roll_no=$roll_no");
var_dump($res);
?>
But whenever I do it directly It works fine for example like this
<?php
$mysqli = new mysqli("localhost", "root", "password", "database");
$roll_no='9999-SO-12';
$res = $mysqli->query("SELECT name,title FROM student_data WHERE roll_no='9999-SO-12'");
var_dump($res);
?>
So what am I doing wrong? What's the solution?