Good day!
There is a txt file
Имя|id Вася|5 Петя|8 Таня|6 Катя|4 There is a code
$id = 6; $page_content = file("rs.txt"); foreach($page_content AS $value) { $result = explode("|", $value); $name = $result[0]; $user_id = $result[1]; if( $id == $user_id ) echo $name; } there is markup html
<div id="6">echo $name;</div> <div id="8">echo $name;</div> <div id="4">echo $name;</div> <div id="5">echo $name;</div> I need to finish the code so that when id is equal to diva and $ user_id from the code, the corresponding code would appear between divs and how to replace $ id = 6; on id's value diva? the code will find all the divs with id and compare their value $ user_id
In the end, I should get
Таня Петя Катя Вася each diva has his own style, there will be more than 100 values I can put the php code inside the diva and get the desired result, only the digit $ id = "" will change; and the code will come kilometer
ifyou can write without curly brackets, this is not an error, and the condition code will be executed to the nearest semicolon. - Edward