Mysqli problem, help please! :-)

Hi, I switched to mysqli and everything works fine except this part of the pagination function. Where did I go wrong? Thanks in advance.

Warning: mysqli_query() expects at least 2 parameters, 1 given in...

function pagination ($query, $url, $page, $step ) {

$result = mysqli_query($query) or die( mysqli_connect_error($result) );

$row = mysqli_fetch_array($result);

$pages = intval( ($row[0] - 1 ) / $step ) + 1;

if ( $pages > 1 ) {

echo "<div id=\"pgn\">\n";

if ( $page==2 )

echo "<a href=\"/$url.htm\">&laquo;</a>";

else if ( $page>1 )

echo "<a href=\"/$url-".($page - 1).".htm\">&laquo;</a>";

else

echo "&nbsp;";

echo "\n";

$last = min( $pages, $page + 3 );

$first = $last - 5;

if ( $first < 0 ) { $last = min($pages, $last - $first); $first = 0; }

for ( $i = $first; $i<$last; $i++ ) {

if ( $i==( $page - 1 ) )

echo "<span id=\"active\">".($i+1)."</span>";

else

echo "<a href=\"/$url".( $i ? "-".($i+1) : "" ).".htm\">".($i+1)."</a>";

}

echo "\n";

if ( $page < $pages )

echo "<a href=\"/$url-".($page + 1).".htm\">&raquo;</a>";

else

echo "&nbsp;";

echo "\n</div>\n<div class=\"break\"></div>\n";

}

return $pages;

}

pagination ($conn, "SELECT COUNT(*) FROM tab_user WHERE status='Y' AND category=$cid", $url, $pagina, $item_per_pagina );

Answers 0

Related Articles