I just saw this following usage of sql prepare statement and was wondering if this would actually prevent sql injection to occur.
$sql= "Select * from mytable where id =" . $id;
$stmt = $con->prepare($sql);
$stmt->execute();
By not using the parameterized variables for $id to provide the value later and avoid appending the value directly, I was wondering if this provides enough protection against sql injection?
Thanks.