php functions
php - Embed PHP-genereated image in an HTML page
<img src="image1.php" />
What does your user agent claim to support?
Validate Your Style Sheet
Validate Your Markup
Link Checker
php - Booleans
The following values are false:
  • The keyword false
  • The integer 0
  • The floating-point value 0.0
  • The empty string ("") and the string "0"
  • An array with zero elements
  • An object with no values or functions
  • The NULL value
Any value that is not false is true.
php - Comparison of Floating Point Values
 int( 1000 * a ) == int( 1000 * b ) tests to three decimal places.
php - Arrays
while( list( $key, $value ) = each( $arrData ) ) {
echo "$key - $value<br />"
}
reset( $arrData );
php
PHP and MySQL Web Development ( Welling and Thomson )
Getting the Date and Time form PHP
Converting Between PHP and MySQL Date Formats
Date Calculations
php and mysql
$dbh=mysql_connect("localhost","username","password");
mysql_select_db("mydatabase");
$resultId = mysql_query( $qry );
while ( $row = mysql_fetch_array( $resultID, MYSQL_ASSOC )) {
print( "<tr>\n" );
print( "\t<td id=\"t{$row[ tasksID ]}\" class=\"tasks\" onclick=\"deleteMe( this.id);\">{$row[ task ]}</td>\n" );
print( "\t<td>{$row[ start ]}</td>\n" );
print( "</tr>\n" );
"}";
php
fopen.txt
fopen( "$DOCUMENT_ROOT/../orders/orders.txt", "w" )
$DOCUMENT_ROOT is built-in php function referring to the root on the web server.
The ".." refers to the parent of the web server root.
The folder named orders is outside the document tree.
JavaScript
Make 12 digit time stamp
Ascii Web Display
JavaScript
a.unshift( 'val' ); inserts arguments at beginning of array, shifting existing indexes to higher indexes. Returns a.length.
a.shift(); removes element w/ lowest index value and returns that element's value.
unshift/shift: filo, first in - last out. Creates a stack.
a.push( 'val' ); inserts arguments at highest index value.
a.pop(); removes element w/ highest index value and returns that element's value.
unshift/pop: fifo, first in - first out. Creates a que.
<?php function alertMe( $s ) { print( "<script type='text/javascript'>alert('" . $s . "');</script>"); } ?>
File and Folder Picker Module for VBA
Web-Dev Add-In
GMT Form:
DAY, DD-MMM-YYYY HH:MM:SS GMT, where
DAY is the day of the week (Sun, Mon, Tue, Wed, Thu, Fri, Sat),
DD is the day in the month (such as 01 for the first day of the month),
MMM is the three-letter abbreviation for the month
 (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec),
YYYY is the year, HH is the hour value in military time (22 would be 10:00 P.M., for example),
MM is the minute value, and SS is the second value.
javscript Time Functions
var d = new Date();
var y = d.getYear();
var mo = d.getMonth();
var dy = d.getDate();
var m = d.getMinutes();
var s = d.getSeconds();
Clone a Node (js)
Function Literals (js)
var total=function(item,tax) {return item += tax};
document.write("Your bill is $" + total(14.95,.06));
dummy link (js)
<a href="javascript:void(a=1);void(b=prompt('Enter a number:','99'))">
<script type="text/javascript" src="/~jf48/support/validations/valid.js"></script>
<body onload="startValid();">
<div id="valid"></div>
a:link, a:visited{text-decoration: none;background:#e0e0e0;color:#0000ff;}
a:hover{text-decoration:underline;}
Mouse-hover title  <a title="Informative title" href="some.html">A Link</a>
setting cookies: php
setcookie( "auth","1",time()+3600,"/~jf48","www.eng.buffalo.edu",0 );
setcookie( 'id',"$id",time()+3600,"/~jf48","www.eng.buffalo.edu",0 );
setcookie( 'bogus',"veritae",3600,"/~jf48","www.eng.buffalo.edu",0 );

reading cookies: php
$authLevel = $_COOKIE[ 'auth' ];

setting cookies: javascript
var expireDate=new Date();
var expireString="";
expireDate.setTime(expireDate.getTime() + ( 1000*60*60*24*365));
expireString = "expires=" + expireDate.toGMTString();
document.cookie = "userName=Fred;path=root" + expireString + ";";
document.cookie = "thisStatement=false;" + expireString + ";";

reading cookies: javascript
<script type="text/javascript">
var arrCookie = new Array();
arrCookie = document.cookie.split( ';' );
for( var i = 0; i < arrCookie.length; ++i )
{
  arrKv = new Array();
  arrKv = arrCookie[ i ].split( '=' );
  for( var j = 0; j < arrKv.length; j += 2 )
  {
    alert( "Name: " + arrKv[ j ] + " Value: " + arrKv[ j+1 ] );
  }
}
 <a href="/root_file.html"> File in jaymze.org root </a>
 <a href="/~jf48/root_file.html"> File in eng.buffalo.edu/~jf48 root </a>
// This function is passed a DOM Node object and checks to see if that node // represents an HTML tag; i.e., if the node is an Element object. It // recursively calls itself on each of the children of the node, testing // them in the same way. If the invocation passes the Document object, // it traverses the entire DOM tree. function countTags(n) { var numtags = 0; if ( n.noteType == 1 /*Node.ELEMENT_NODE*/ ) { numtags++; } var children = n.childNodes; for(var i=0; i < children.length; i++ ) { numtags += countTags( children[ i ] ); } return numtags; }
javascript: <script type="text/javascript"> function checkEnter(e){ if(e.keyCode==13){ document.frm.submit(); } } </script> <form name="frm" method="post" action="<?php print $PHP_SELF ?>" onsubmit = "return validateform();"> <input type="text" onkeypress="checkEnter(event);" accesskey="j" name="txt" /> </form>
javascript: var arrColor = new Array(); arrColor['Yes'] = new Array(); arrColor['Yes']['410'] = '#ffffcc'; arrColor['Yes']['412'] = '#ffccff'; arrColor['No'] = new Array(); arrColor['No']['410'] = '#000000'; arrColor['No']['412'] = '#000000';
javascript: var dteNow =new Date; var hr = dteNow.getHours(); if( hr < 10 ){hr = "0" + hr;} var min = dteNow.getMinutes(); if(min<10){min="0"+min;} var sec = dteNow.getSeconds(); if(sec<10){sec="0"+sec;} alert( hr + ":" + min + ":" + sec);
javascript:
var arrId = strId.split(" ");
css:
document.getElementById("id).style.fontWeight = 'bold';
javascript:
roomColor = m.currentStyle.backgroundColor;
MySQL:
update target.fieldx = source.fieldA select source.fieldA, target.fieldx from target, source where target.pk = source .fk
javascript:
parent = node.parentNode;
for ( var i = parent.firstChild; i != null ; i = i.nextSibling ) {}

Valid XHTML 1.0 Transitional
Valid CSS!