php - Display when the last visitor upvoted or downvoted next to the vote buttons -


i have php based cms website. people have ability or down vote piece of content. previously inquired how add time stamp vote buttons person can see how else has voted on content.

i have following table:

<table class="rating-table" cellspacing="0" cellpadding="0" border="0">       <tr>         <td><?php echo kohana::lang('ui_main.credibility');?>:</td>         <td><a onclick="myfunction()" href="javascript:rating('<?php echo $incident_id; ?>','add','original','oloader_<?php echo $incident_id; ?>')"><img id="oup_<?php echo $incident_id; ?>" src="<?php echo url::file_loc('img'); ?>media/img/up.png" alt="up" title="up" border="0" /></a></td>         <td><a onclick="myfunction()" href="javascript:rating('<?php echo $incident_id; ?>','subtract','original')"><img id="odown_<?php echo $incident_id; ?>" src="<?php echo url::file_loc('img'); ?>media/img/down.png" alt="down" title="down" border="0" /></a></td>         <td><a href="" class="rating_value" id="orating_<?php echo $incident_id; ?>"><?php echo $incident_rating; ?></a></td>         <td><a href="" id="oloader_<?php echo $incident_id; ?>" class="rating_loading" ></a></td>         <td>last voted at:                      <span id="vote_date">                     <script>                     function myfunction()                     {                     var d = new date();                     var x = document.getelementbyid("vote_date");                     x.innerhtml=date();                     }                     </script>                     </span>          </td>          </tr>     </table> 

the second , third <td> elements , down vote buttons. when clicks them time , date displayed in last <td> element. great!

except (beginner here) need not session specific. if else visits page next day, should see last time interacted vote buttons.

i have limited coding skills suspect must somehow store output of myfunction in table , echo when else visits page - right? there simpler way?

here example of i'm trying on live site. time last person voted should displayed next vote buttons (code block above on localhost): http://tinyurl.com/k5w4olu

you on right track need add date database or memory. best way ajax date variable mysql db have setup , connected via php.

to understand more mysql go here -> http://www.w3schools.com/php/php_mysql_intro.asp

you need use ajax easiest way jquery library -> http://www.w3schools.com/jquery/jquery_ref_ajax.asp


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -