You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '='' ORDER BY codigo ASC LIMIT 0,20' at line 1
El codigo que usaba y funcionaba era:
Código PHP:
<?php
if (!isset($pg))
$pg = 0; // $pg es la pagina actual
$cantidad=20; // cantidad de resultados por página
$inicial = $pg * $cantidad;
$pegar = "SELECT * FROM articulosboda WHERE $vari='$cat' ORDER BY codigo ASC LIMIT $inicial,$cantidad";
$cad = mysql_db_query($base_dato,$pegar) or die (mysql_error());
//$result = mysql_query($query, $connection);
$contar = "SELECT * FROM articulosboda WHERE $vari='$cat' ORDER BY id";
$contarok= mysql_db_query($base_dato,$contar) or die (mysql_error());
$total_records = mysql_num_rows($contarok);
$pages = intval($total_records / $cantidad);