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:

Troubleshooting
Research
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

mysql into an array

Avatar of ussher
ussherFlag for Japan asked on
PHP
15 Comments1 Solution312 ViewsLast Modified:
Hi,

Im wanting to get a query from mysql put it into an array and use the previous and next values of the array for my 'previous' and 'next' page numbers

what i have so far is being able to create the array:

<div id="nav_next">
<?
    $sql    =   "SELECT user_id
                   FROM joined_users";
    $res    =   mysql_query($sql);

  while($row = mysql_fetch_array($res)){
  $array1[]= $row[' user_id '];
  }

 print_r($array1);    // prints out as Array ( [0] => 44 [1] => 46 [2] => 47 [3] => 48 [4] => 50 )
// now what i want to do is put this into the navigation so that the next brings up the next number in the array. where  $current_id = (the user_id)
 ?>
 <a href="index.php?Act=view_profile&id=<?=$array1['0']?>"> Previous</a>
 <a href="index.php?Act=view_profile&id=<?=$array1['2']?>"> Next</a>
</div>

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Raynard7
Commented:
This problem has been solved!
Unlock 1 Answer and 15 Comments.
See Answers