Simple Javascript to write to mysql

This is more of a braindump/code dump for me. Original source

Note: If you are going to use PHP values in this script please make sure they are set first…

Note2: I know javascript isn’t writing directly to mysql, this is my preferred method. function.php does the actual writing to mysql.. (uses update function – if you are reading this I expect you already know how to write a simply mysql update/insert statement and execute it inside of php..

Example.html

<!-- Function to save avatarID -->
<script type="text/javascript">
function showUser(str)
{
if (str=="")
  {
  document.getElementById("avatarsavediv").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("avatarsavediv").innerHTML=xmlhttp.responseText;
    }
  }
// best to set a new variable name so I don't forget what I'm working on
var avatarid = str;
// below we can grab a mysql value if we need to
var phpnickname = "<?= $username ?>";
var avurl = "function.php?nickname="+phpnickname+"&avatarid="+avatarid;
xmlhttp.open("GET",avurl,true);
xmlhttp.send();
}
</script>
<div id="avatarsavediv"></div>

Final note: The above shows the output

Reblog this post [with Zemanta]

2 new visual ways to follow school blogs

Spective provides a visual way of sifting through school blogs by showing the image and using the image as context.

URL: http://www.spectives.com/primary

RSSVoyage displays only text on your page but allows you to easily move through blogs and time.  RssVoyage requies you paste the RSS feed address in (bottom left).   RSSVoyage has been pretty buggy for me, let me know what your experience is like!

URL: http://rssvoyage.com

Feed URL: http://www.xfruits.com/johnyma22/?id=80412

Both require registration, both are free.

New Creative Vado HD software Movie creation has been removed

So, I’m waiting on confirmation for this but it looks like the team at Creative have removed the ability to make edited movies/videos from within the Vado Central software on the latest Creative Vado HD cameras.  

What does this mean in real terms for a teacher?  No ability to put on text before or after your video footage & no ability to add nice themes to your video.  The software on the Vado was probably one of the most impressive things about it, now they have destroyed that I’m not so sure how I feel about the plucky plastic video snapper.

This is a very bad decision. What are Creative thinking? They also made the buttons less obvious they have been pressed too making the device slightly less accessible for early years children.

This is the old camera that does support making a movie.   The new version looks like a chav’d up renault 5.

Old version:

New version: