nuovamente buongiorno ,volevo domandarvi perche una query , stampa un errore warning posto l errore
codice:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\Programmi\Apache Software Foundation\Apache2.2\htdocs\class_pager-2004-10-22\class.pager.example.php on line 20
e la query:
Codice PHP:
$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; }
$num_results = $result ; //this value should arrive from some database query, like "select count(id) from table_you_want_to_page"
$per_page = 1; //number of results to be shown per page
$query_string = "class.pager.example.php?"; // current file..
echo $num_results ;
$sql ="SELECT * FROM tech order by staffid asc limit $per_page , $num_result ";
$query = mysql_query($sql);
while($row = mysql_fetch_assoc($query) )
{
echo $row['nome'].'-'. $row['cognome'].'-'. $row['username'].'
';
}
$pr = new pager($num_results, $per_page, $query_string); //building a pager
$pr->num_results = $result;
$pr->per_page = $per_page;
$pr->query_string = $query_string ;
$range = 9; //set the range of page button list
echo $pr->getButList($range);
$pr->getPageFrom($page);