Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

page numbers problem with displaying numbers

Avatar of playstat
playstat asked on
8 Comments1 Solution383 ViewsLast Modified:
how can i output and start from 1 2 3 etc (at the moment it starts at 0 1 2 3 etc

example code

if($page <= 0)
    $page = 1;

$myarray = file ($_FILES['keywordfile']['tmp_name']);       // this reads a text file from a php form
$lines = count($myarray);                                               // counts the number of lines for the text file
$fp2 = explode($lines,$myarray);                                    // seperate $myarray to lines

$start = ($page * $lines) - $lines;                                   // how many page numbers will be created

$news = array_splice($myarray, $start, $lines);               // prblem here outputs href numbers that starts with 0 (array_splice problem maybe)
$news=str_replace(" ","-",$news);                                  //replaces all spaces per line with a - on other php page outputs with .php extension

foreach($news as $key=>$value)
    echo "<a href=\"$value.html\" title=\"$value\">$key\n</a> | ";    // outputs href links and assigns each text file line per number - starts at 0


Avatar of jkna_gunn

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answers