×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Flatfile reading?

Flatfile reading?

Flatfile reading?

(OP)
I need to know how open a flatfile for reading and submitting in a html form.

heres how the flat file looks.
$field1¦$field2¦$field3¦$field4¦

I need to be able to open that file while grabbing only 10 results at a time.

Any ideas?

RE: Flatfile reading?

(OP)
.

RE: Flatfile reading?

I use a small technique collect all the values from the flat file in a array.display the first 10 values.

$r is the starting point.
$results=10(10 sets of result)

$x=$r+$results;
ie) for($i=$r;$i<$x;$i++)
      {
         print $filearray[$i];
      }
to get the next set of results pass the starting point in $r
         

Thus u can display 10 set of results from a flat file.

I hope u got the logic....

RE: Flatfile reading?

(OP)
Hello,

Ok ive been able to get the code working. Although i have run in to a problem. If any one can take a look and maybe let me know what im doing wrong that`d be great. Problem is that i have the results printing to the page in lots of 5... but each result is the same. Last line in the data file.

Any ways heres the url
http://wmhc.hypermart.net/cgi-bin/submit/view.cgi
and the code below.

Thanks guys,
wazza
--------start---------
@results = ($invoiceno,$contactname,$contactemail,$company,$address,$state,$city,$zipcode,$country,$title,$description,$category,$emailcategory,$password,$url,$recipurl,$signupurl,$date);
   $number_of_sites = @results;
   $result_count = $number_of_sites;
   $pgsz = 5;

    if ($result_count != 0) {
    $pagecount = int($result_count / $pgsz);
    if (($pagecount * $pgsz) != $result_count) {
    $pagecount++;
    }
    }

    if (!$A::rqpg) {
    $rqpg = 1;
    }
    else {
    $rqpg = $A::rqpg;
    }

    $firstresult = (($rqpg - 1) * $pgsz) + 1;
    $lastresult = $firstresult + $pgsz - 1;
    if ($lastresult > $result_count) {
    $lastresult = $result_count;
    }
    $prev_page = $rqpg - 1;
    $next_page = $rqpg + 1;
    if ($rqpg == 1) {
    $prev_link =

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close