Ok I think I'm really close . The code should look something like this but this doesn't work. I haven't gotten the file stuff to work at all and I'm not sure why. Check the cose out and let me know what's wrong. The concatenation is the only thing I can confirm as working.
/*******************************************************************
Cycles through user names "user_1" through "user_50" then resets and starts over. The
current number is stored in a text file.
*******************************************************************/
$user_file_name = 'current_user.txt'; //File name
if(($current_user_file = fopen($user_file_name, 'r')) ===FLASE){ //Open file to read the current user number
die('Failed to open file for reading!');}
$current_user_number = fgets($current_user_file, 2); //reads the user number from the file
$database_user_string= "user_" . $current_user_number; //add the text "user_" and number (ie "user_3)
fclose($current_user_file); //close the file
if(($current_user_file = fopen($user_file_name, 'w')) ===FLASE){ //Open file to write the current user number
die('Failed to open file for writing!');}
$current_user_number++; //incement $current_user_number by 1
if($current_user_number > 49)
$current_user_number = 0; //reset $current_user_number if it gets to 50
else
fwrite($current_user_file, $current_user_number); //Write the over the new $current_user_number
fclose($current_user_file); //close the file