new to php, need abit help

hey guys i’m new to php and mysql
and i find myself stuk abit in this statement i need to execute
but i’m not sure how to put everything together.

what i want is to bascilly form a statment that says every “x seconds” a random column within
a table will be inserted into another table.
I know how to make an Insert function when i press a button.
but how do i make it soo is will automaticlly insert it every “x seconds”?

sorry i got no code for ya, i’m really not sure which statment to use, a while loop? a foreach loop? and how to combine it with “time()” and etc…

thank’s advanced!

Do you want a column to be inserted into another table??? or a row??

my bad, a random row ofcourse >.<

Honestly the first thing that came to mind for me is to use JQuery’s ajax functionality along with setInverval

It would be something like this (I’m not saying this would work but it will give you an idea)…

javascript file…

function insertRandomRow(){

    $.get('insertRandomRow.php', function(data){
        if(data !== 'true'){


var insertEveryXSeconds = 1000 // 1 second

setInterval('insertRandomRow()', insertEveryXSeconds);


<?php $sql = // run your sql query if($sql){ echo 'true'; } else { echo mysqli_error($link); } [/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service