Now, I want to be able to repeat this sql query every lets say 5 minutes, because the tables content will change. How can I do this? Is there a way to do an sql request in a javascript or ajax script?
I know, thats good for me, I would love to do it with javascript. In fact, I need to do it with javascript. But as far as I learnt, you cant run a mysql query inside a javascript function can you?
it worked fine anyways, but yours work too. For me when something does what I want, I always have the idea that its ok to stick with it. But you guys learn me that I should always do the right way, and take precautions.
About doing it every 5 minutes. Can someone show me how can I use ajax or javascript for this. Because on another forum, someone asked the same, and they said it’s not possible to do mysql query in a javascript function… How will I than?
If I have an array 0=>“one”, 1=>“two”, 2=>“three”
I push “four”
the array is now 0=>“one”, 1=>“two”, 2=>“three”, 3=>“four”
I shift
the array is now 0=>“two”, 1=>“three”, 2=>“four”
[quote=“samilkarahisar, post:11, topic:216620, full:true”]
I actually didn’t provide the exact code and table I use in my file.[/quote]
shame on you
[quote=“samilkarahisar, post:11, topic:216620, full:true”]
Now, I want in file1.php to reload this data, so that the first row is now username2 and no more username1.[/quote]
You need to keep in mind that not all of your site’s users will have javascript enabled, so for them the “auto refresh” will be broken, the only reliable way is to use a cron job
Yes but I have a page that already uses javascript for a counter. Because all of this is to give a user only 5 minutes for a page. So even tho I do this one with cron job. Than the counter will still need them enabling javascript.
I think I just got another idea. I may achieve all of this without javascript. Thank you for opening my eyes on this point.
Edit: Its amazing how the brain can focus on his first thought and try hard for that, instead of thinking some more to find a better solution. This is why I love programming. It opens my mind to understand that there is never only one solution. In fact there are always better ones than the one we come up with at first. Thanks alot again for you help.