RSD Academy



PHP and MySQL Tips and Hacks

Renumber the primary index

SET @i=0;
UPDATE table_name SET column_name=(@i:=@i+1);

Upon page reload, move to the current vertical scroll position

Put the following in the page head.

<script language="JavaScript">
function get_cookie(cookie_name){
  var results = document.cookie.match ('(^|;) ?' + cookie_name + '=([^;]*)(;|$)');
  if(results)
    return(unescape(results[2]));
  else
    return null;
  }
}
</script>

Use this body tag.

<body onScroll=\"document.cookie='ypos=' + window.pageYOffset\" onLoad=\"window.scrollTo(0,get_cookie('ypos'))\">

Note:

RSD Academy