Increase view counter with each page view
No, this code is not vulnerable to SQL injection.  The use of intval() and if (… &amp;&amp; $id &gt; 0) guarantee that $id is a positive integer, so the UPDATE and SELECT queries cannot be malicious.

It is very weird that you use the LIKE operator, though.  Is the id column not an INTEGER?  I would expect that that works by converting every id into a string, then performing pattern matching.  That would be slow because


Converting every id in the hdflv_upload table would be extra work.
The database cannot locate the row with the right id using an index; it has to examine every id.
Pattern matching is more complicated than a simple integer equality check.


Note that in this version, you have fixed a race condition that existed in the previous version.  In the previous version, it is possible to under-count if two pages simultaneously try to update the count, and the sequence ends up being SELECT, SELECT, UPDATE, UPDATE.  This code is better because UPDATE hdflv_upload SET times_viewed = times_viewed + 1 WHERE … should be immune to race conditions.