So I've recently switched to using MySQLi. And I have a few questions about it.
My current code to fetch a data is
$current = "SELECT * FROM hi where username='me'";
$result = $connect->query($current) or die($mysqli->error.__LINE__);
$row = $result->fetch_assoc();
and my execution of a query is
$current = "SELECT * FROM hi where username='me'"; $result = $connect->query($current) or die($mysqli->error.LINE);
First question, is it the correct way?
And how is it more secured than the mysql_ method? (I heard it prevents injections or something)
Lastly, apart from using MySQLi now, what else should I do? Is my code secured enough?
I previously used mysql_real_escape_string(htmlspecialchars($string) on any data which will be used in the mysql query, do I still need to use them? Since I'm using MySQLi now.
What other things should I take note of to make my site secured? htmlspecialchars any user inputs?
Thanks!