Skip to content

Instantly share code, notes, and snippets.

@ameyer
Created June 26, 2009 05:56
Show Gist options
  • Save ameyer/136322 to your computer and use it in GitHub Desktop.
Save ameyer/136322 to your computer and use it in GitHub Desktop.
// this should play a sound when the up arrow is pressed.
var audio = new Sound(); // audio variable
audio.loadSound("name.mp3",false); // change for the name of the file. False means not to stream
var isplaying = no;
onEnterFrame= function(){ //run this code every frame
if(Key.isUP(Key.UP)){ // do this when up key is up
if(isplaying == 'yes'){ //is the file playing?
isplaying = no; //set it to show it is playing
audio.stop();
}
}
if(Key.isDown(Key.UP)){ // do this when up key is down
if(isplaying == 'no'){ //is the file playing?
isplaying = yes; //set it to show it is playing
audio.start();
}
}
}
<?php //mysql_connect.php
DEFINE ('DB_USER', 'userName'); //config
DEFINE ('DB_PASSWORD', 'Password'); //config
DEFINE ('DB_HOST', 'localhost');
DEFINE ('DB_NAME', 'DB_Name'); //config
//Make the connection
$dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('could not connect to mysql:'.mysql_error());
//Select the database.
@mysql_select_db(DB_NAME) OR die('Could not sellect the database:'.mysql_error());
//to get the info from a table with only one row
$sql = 'SELECT * FROM table';
$query = mysql_query($sql);
$row = mysql_fetch_array($query, MYSQL_ASSOC);
$yourOutValue = $row['column_name']
//to update said row
$sql = 'UPDATE user SET column_name='.$valueToPutIn;
$query = mysql_query($sql);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment