Monday, September 29, 2008

MySQL Count Distinct

I was having trouble trying to count up the number of enries in a database.  I was doing a join and wanted only the unique entries from another table so that I wouldn't get a inflated count.

You can do a COUNT with the DISTINCT tag in it to accomplish this.

Example:
SELECT COUNT(DISTINCT results) FROM student;

Thursday, September 25, 2008

Flash ASCII Code

If you need ASCII characters (+, > , %, etc) this link will give you all the values to put into the text file (txt, php, whatever) for translation to Flash textareas.



Friday, September 12, 2008

IIS7 Custom Error Pages & Debug Information

Ever wanted to create custom error pages or change the default debug information that is displayed with IIS?

Thursday, September 4, 2008

PHP Cheat Sheet

This is an interesting little cheat sheet for PHP.  It doesn't cover a whole lot of functions, but it does have some that are used often.  Might save you  a lot of time.

SEO: Stopping Search Engine Indexing

If you wanted to stop Google from indexing your website (or any other search engine) you can include a robots.txt file on your server.  This file is checked by search engine bots before indexing and they follow whatever rules you put in there.

You can find detailed information on how to write your robots.txt here: http://www.google.com/support/webmasters/bin/answer.py?answer=40360


Wednesday, September 3, 2008

Search button and field alignmnet

CSS DOCUMENT

#email {

margin: 0px 2px;
width: 110px;
_width: 110px;
padding: 2px 2px 0 2px;
_padding-right: 18px;
height: 16px;
_height: 16px;
background-color: #FFF;
border: 1px solid #afa9a6;
-moz-box-sizing: content-box;
float:left;
font-size:10px;
}

.search { background-image:url(/images/layout/speedclub_signup.gif); }

button.icon-replace {
-moz-outline: none;
padding: 0;
border-style: none;
background-color: transparent;
background-repeat: no-repeat;
background-position: center center;
margin:0;
}

.icon-replace {
background-repeat: no-repeat;
background-position: center center;
display: inline;
display: inline-block;
display: -moz-inline-box;
_display: inline;
zoom: 100%;
width: 44px;
padding: 0 !important;
overflow: hidden;
white-space: nowrap;
text-align: left;
word-spacing: -2ex;
letter-spacing: -2ex;
min-height: 20px;
_height: 20px;
color: transparent !important;
_font: 1px/0 monospace;
_word-spacing: -2px;
_letter-spacing: -2px;
}



WITHIN HTML
<input name="email" id="email" class="speedclub_input" type="text">

<button type="submit" id="search-submit" class="icon-replace search"><span style="display: none;">Search</span></button>

MSSQL Count Query

The count query is very useful in SQL.  Below is the syntax:

SELECT COUNT(thefield) AS outputvariable FROM tablename GROUP BY thefield HAVING anyfield = yourvalue

  • thefield is what you want to count
  • outputvariable is what you want the count to be saved in
  • tablename is the name of the table to look into
  • anyfield is any field you want to use as a criteria
  • yourvalue is the value for your criteria

This may also work the same for MYSQL.