Limit Bug w/Dynamic Variable

Here is the problem I’m having.


$min = ($pg - 1) * 6;

//query ends with ORDER BY videos.views DESC LIMIT $min,6

That works great. But I’m trying to grab a page number dynamically:

$page = $_GET['page'];
if(!$page) {
$page = 1;

//when echoed shows proper number
$min = ($pg - 1) * 6;

Now the exact same query doesn’t work, as $pg=$page is causing some sort of bug/error. I’ve tested it and echoed the results and it comes to same conclusion.

But mysql stops working if the $min variable was created with the $page variable in-between the if statement. why?

Any help appreciated.



Turns out that something buggy was happening with the variable passing and I spotted it.