select query from mysql_num_rows
Posted
by
Andi Nugroho
on Stack Overflow
See other posts from Stack Overflow
or by Andi Nugroho
Published on 2012-07-04T02:57:13Z
Indexed on
2012/07/04
3:15 UTC
Read the original article
Hit count: 266
i want create multiple search where statement $where_search is a multiple condition from post form. but stil error when iam using this code ".where_search." in where condition with mysql_num_rows for paging
$tampil2 = mysql_query("SELECT * FROM bb where ".$where_search." and kd_kelompok='2' and kd_komoditi='11' and nm_sebutan IS NOT NULL " );
this is the complete code.
$where_search = "kd_pok='2' and kd_komoditi='11' ";
if (isset($_POST['lakpus']))
{
if (empty($_POST['lakpus']))
{
}
else
{
if (empty($where_search))
{
$where_search .= "lakpus = '$lakpus' ";
}
else
{
$where_search .= "AND lakpus = '$lakpus' ";
}
}
}
if (isset($_POST['kd_por']))
{
$kd_por = $_POST['kd_por'] ;
if (empty($_POST['kd_por']))
{
}
else
{
if (empty($where_search))
{
$where_search .= "kd_por = '$kd_por' ";
}
else
{
$where_search .= "AND tab1.kd_por = '$kd_por' ";
}
}
}
$max=15;
$tampil2 = mysql_query("SELECT * FROM bb where ".$where_search." and kd_kelompok='2' and kd_komoditi='11' and nm_sebutan IS NOT NULL " );
$jml = mysql_num_rows($tampil2);
$jmlhal = ceil($jml/$max);
© Stack Overflow or respective owner