im learning MySQLi in order to make my site not vulnerable to SQL injections (wich is now) but i get confuse when i was trying to "translate" my old querys to MySQLi statements, so i hope you can help me with some examples so i can get it. Thanks a lot!.
Updating my site counter
$sql = "UPDATE post SET counter = counter+1 WHERE id=".$tget;
Sorting my comments
$info=mysql_query("SELECT * FROM `comments` WHERE idpost=" . $tget . " AND active=1 ORDER BY datetime DESC");
Saving the comment
$sql = "INSERT INTO `comments` (`id`, `idpost`, `comment`, `datetime`, `author`, `active`) VALUES (NULL, '" . addslashes($_POST['idcomment']) . "', '" . addslashes($_POST['comment']) . "', NOW(), '" . addslashes($_POST['name']) . "', '1');";
If you can explain me how to go from here to MySQLi i can finish with the others querys.
And by way, if you (expert) consider that there is other way to protect me from sql injections better than MySQLi, please tell me about it.