Hi, i am fetching a text from mysql database and i get it by ID in the url:
site.php?id=1 and so on
What is considered to be most safe to prevent sql injection and stuff. Is this way correct:
<?php
$news_id = $_GET['news_id'];
if(!is_numeric($news_id)) die('Wrong');
//mysql_query and stuff here
?>
OR this way:
<?php
$news_id = $_GET['news_id'];
if(!intval($news_id)) die('Wrong');
//mysql_query and stuff here
?>