LSmithx2 LSmithx2 - 22 days ago 5x
PHP Question

PHP Arrays Selection from URL

I have coded a internal messenger system for the company I work for and I am trying to make things easier for myself by making a admin panel for this so it can control the usernames, passwords and groups.

Basically I am trying to select a user from the array using a url

which will then return the user information and allow it to be changed. The problem I am having is to get the url to select the username in the array.

The array is basic:

$users = array(
'0' => array(
'username' => 'test',
'password' => 'test123',
'group' => 'office',


Like this?:


// get username from URL (GET METHOD)

// $users has all the info

foreach ($users as $u) {
  // find the target user
  if ($u["username"] == $username) {
      // do something with $u