Index.php file
<?php include_once("bd.php"); $resultat = mysql_query("SELECT * FROM users WHERE id='$_GET[id]'"); $array = mysql_fetch_array($resultat); ?> For each user at the end of your id (example.com?id=1)
<div id="button"></div> </div> <script src="js/button.js"></script> File time.php
Connection to the database, where data is selected by id and the corresponding data is inserted into the button
<?php include_once("bd.php"); $resultat = mysql_query("SELECT * FROM users WHERE id='$_GET[id]'"); $array = mysql_fetch_array($resultat); ?> The function to insert the button itself
<?php do{ echo "<a style='display:".$array['active1']."; ' class='button' href='".$array['url1']."' target='_blank'>".$array['url_name1']."</a>"; } while($array = mysql_fetch_array($result)); ?> Js file
I get the page parameter from the link itself (example.com?id = ...)
function getUrlVars() { var vars = {}; var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { vars[key] = value; }); return vars; } var id_user = getUrlVars()["id"]; function show(){ $.ajax({ url: "time.php", data: 'id=id_user', cache: false, success: function(html){ $("#button").html(html); } }); } $(document).ready(function(){ show(); setInterval('show()',1000); }); The time.php file also goes for each user ( time.php? Id = ... ), how to make a request that when entering the page ( index.php? Id = 15 ) a request was sent to the time.php file with the same parameters ( time.php? id = 15 ).
Now the request is sent clumsily ( time.php? Id = id_user & _ = 1488322194611 ), but should be sent like this ( time.php? Id = number equal to the id file of the index) for 3 days dug all Google and could not find anything like that. Help please, I will be very grateful!
data: 'id='+id_user,- Igor