-1
$i = 0;   

$name_url = '../../accounts/full/'.$frd_array[$i].'/profile/name.txt';
$name = file_get_contents($name_url);
$user_id = file_get_contents('../../accounts/full/'.$frd_array[$i].'/profile/user_id.txt');
$status = file_get_contents('../../accounts/full/'.$frd_array[$i].'/profile/status.txt');

echo "
        <div class='frd_acc'>
        <img class='c_avatar' src='../accounts/full/".$frd_array[$i]."/profile/avatar.png'>
        <div class='c_name'>".$name."</div> <kbd class='c_user_id'>".$user_id."</kbd>
        <div class='status'>".$status."</div>
        </div>"

above is my php code. when im executing this php script im getting the following errors:

Warning: file_get_contents(../../accounts/full/amaan2 amaan2 /profile/name.txt): failed to open stream: Invalid argument in E:\FreeJi\php\chats\my_frds.php on line 16

Warning: file_get_contents(../../accounts/full/amaan2 amaan2 /profile/user_id.txt): failed to open stream: Invalid argument in E:\FreeJi\php\chats\my_frds.php on line 17

Warning: file_get_contents(../../accounts/full/amaan2 amaan2 /profile/status.txt): failed to open stream: Invalid argument in E:\FreeJi\php\chats\my_frds.php on line 18

Please Help ME!!!

Andreas
  • 23,610
  • 6
  • 30
  • 62
Shaikh Amaan FM
  • 312
  • 4
  • 12

2 Answers2

0

Try $_SERVER['DOCUMENT_ROOT'].'/accounts/full/'

sreid
  • 1
  • 2
0

Please do

$name_url = '../../accounts/full/'.trim($frd_array[$i]).'/profile/name.t‌​xt';

in order to remove extra spaces

Alexios Tsiaparas
  • 880
  • 10
  • 17