Announcement

Collapse
No announcement yet.

dbase querring probs

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • dbase querring probs

    i tried to make a script to test a displaying dbase info and sorting it to pages where there 10 results per page.

    it gives me no error, it just shows "1"

    here is the code:
    PHP Code:
    if($show="true") {
     
    $connect=mysql_connect ("""i""");
     
    mysql_select_db (""); 

     print(
    "\nResults:<br>");

    if(!isset(
    $page)) {
     
    $page=1//if no page specified then current page is one
    }

    $resultsPerPage 10
    $startrow $page*$resultsPerPage

    $qry1 "SELECT count(*) FROM test";
    $qry2 "SELECT * FROM test LIMIT $startrow,$resultsPerPage";

    $result1 mysql_query($qry1);
    $result2 mysql_query($qry2);

    $total mysql_result($result1,0,"count(*)"); 
    //$total=mysql_num_rows($result1); 
    $pagesfloor($total/$resultsPerPage);

      
    $i=1;
      while(
    $row mysql_fetch_array($result2)) {
       echo 
    "\n$i - ";
       
    printf("%s, %s - %s\n",$row["hebrew"], $row["english"], $row["id"]);
       echo 
    "<br>";
       
    $i++;
      }

    for(
    $j=0;$j<=$pages;$j++) {
     if(
    $j=$page)
       echo 
    $j;
     else 
      
    printf("<a href='%s?page=%s'>%s</a>"$PHP_SELF$j$j);
    }

    mysql_close($connect);

    Last edited by DiZi; Tue 2 Oct '01, 2:26pm.
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X