salve ragazzi ancora una volta apro un thead di richiesta di aiuto , vi spiego io ho due funzioni , da una estraggo gli utenti e va benissimo e dallaltra dovrei passare le variabili definite soltanto che quando inserisco nella query degli user il limit e le variabili definite nell altra funzione mi da un errore che sarebbe questo
codice:
Manage Staff - Total:2
Nome username gruppo Actions
Error 1064 : 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 '' at line 1
questa e la funzione degli user : le variabili sono dopo il limit $per_page $item
Codice PHP:
function GetStaff()
{
global $dbcore;
global $settings ;
global $per_page,$item ;
$query = "select t. * , gs. id_groups ,gs. nome_group from tech t left join grouptech gs on t. groupid = gs. id_groups order by t. staffid asc limit $per_page,$item ";
$sql = mysql_query($query) or die("[B]Error ".mysql_errno()." :[/B] ".mysql_error()."");
$return = array();
while ($row = mysql_fetch_assoc($sql)){
$return[] = $row;
}
return $return;
}
e questa e la funzione dove io diciaro le variabili
Codice PHP:
function PagerTech($page ,$item)
{
global $dbcore;
global $settings ;
global $per_page,$item ;
$array = mysql_query("SELECT * FROM tech where staffid = staffid ");
$result = mysql_num_rows($array);
if (isset($_GET['page'])) { $page = intval($_GET['page']); } else { $page = 1; }
$per_page = 1; //Items per page
$num_results = $result; //this value should arrive from some database query, like "select count(id) from table_you_want_to_page"
$item = $num_results ;
$item = ($page*$per_page)-$per_page;
$query_string = "class.pager.example.php?"; // current file..
$pr = new pager($num_results, $per_page,$query_string); //building a pager
$pr->num_results = $num_results;
$pr->per_page = $per_page;
$pr->query_string = $query_string ;
$range = 9; //set the range of page button list
echo $pr->getRangeInfo();
echo $pr->getButList($range);
}