Thanks for your helpsub loadArticleSelection { $lang = $query->param("lang") ; my $country_swiss = $query->param("country_swiss"); my $country_france = $query->param("country_france"); my $with_lang_french = $query->param("with_lang_french"); my $with_lang_german = $query->param("with_lang_german"); my $with_lang_italian = $query->param("with_lang_italian"); my $with_lang_english = $query->param("with_lang_english"); my $cat = shift || ''; my $type = shift || ''; my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtim +e(); my $date = sprintf "%4d-%02d-%02d \n",$year+1900,$mon+1,$mday; my $depot = $query->param("depot"); $depot =~ s/[^A-Za-z0-9 ]/; my $string = ""; my $index = '0'; my $total = '0'; my $add; my $add2; my $dep; if ($country_swiss eq '1') { $add .= "AND article.ref_pays = 1"; } if ($country_france eq '1') { if ($country_swiss) { $add .= "OR article.ref_pays = 2"; }else { $add .= "AND article.ref_pays = 2"; } } if ($type) { $add2 = "AND id_categorie = '$type'"; } else { $add2 = ""; } if ($depot) { $dep = "AND ref_depot = (SELECT id_depot FROM depot WHERE ville = +'$depot')"; } my ($c)= $mydb->sqlSelectMany("DISTINCT article.nom,marque,label, +prix, pochette", "article,met_en_vente", "ref_article = id_article AND met_en_vente.notre_select +ion = '1' AND ref_statut = '3' AND article.quantite > 0"); while( ($ARTICLE{'name'},$ARTICLE{'author'},$ARTICLE{'label'},$ART +ICLE{'price'},$ARTICLE{'pochette'},$ARTICLE{'genre'})=$c->fetchrow()) + { $total +=1; } my $nb_page = arrondi ($total / 40, 1); my $min_index = '0'; my $max_index = '40'; #print "Content-Type: text/html\n\n"; for (my $i = '0'; $i < $nb_page + 1;$i++) { #my $x = my $j; #print "valeur de i $i <br />"; if ($i <= 9) { $j = "0$i"; }else { $j = $i; } $string .= "<a href=\"/cgi-bin/recordz.cgi?lang=$lang&page=mai +n&session=$session_id&min_index_our_selection=$min_index&max_ +index_our_selection=$max_index&country_swiss=$country_swiss&c +ountry_france=$country_france&with_lang_french=$with_lang_french& +with_lang_german=$with_lang_german&with_lang_italian=$with_lang_i +talian&with_lang_english=$with_lang_english\" ><-$j-></a> &n +bsp;"; $min_index += 40; } if (($nb_page % 10) > 0) { $string .= "<br/>"; } return $string; } sub arrondi { my $n = shift || ''; my $arrondi = sprintf("%.0f", $n); return $arrondi; }
In reply to Need help with pagination by *alexandre*
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |