iD NEWS & BLOG
Populating a Combo-box in PHP Dynamically from MySQL
For this article, let’s pretend you have the following database table. There are two columns (I’m separating the fields with commas for readability), Item and Price:
Cheese Pizza, 1.00
Pepporoni Pizza, 1.50
Sausage Pizza, 1.50
Cheese Calzone, 1.50
Ham Calzone, 2.00
What if you want to populate a combo-box with your possible options? We can write php that generates a drop-down box that has five item choices in it, based on our table above. Here is the sample code:
<?php
// Connect to the database
mysql_connect("localhost", "user", "password") or die(mysql_error());
mysql_select_db("name") or die(mysql_error());
// Has the form been submitted?
if (isset($_POST['item'])) {
// The form has been submitted, query results
$queryitem = "SELECT * FROM table WHERE item = '".$_POST['item']."';";
// Successful query?
if($result = mysql_query($queryitem)) {
// More than 0 results returned?
if($success = mysql_num_rows($result) > 0) {
// For each result returned, display it
while ($row = mysql_fetch_array($result)) echo $row[serial];
}
// Otherwise, no results, tell user
else { echo "No results found."; }
}
// Error connecting? Tell user
else { echo "Failed to connect to database."; }
}
// The form has NOT been submitted, so show the form instead of results
else {
// Create the form, post to the same file
echo "<form method='post' action='example.php'>";
// Form a query to populate the combo-box
$queryitem = "SELECT DISTINCT item FROM table;";
// Successful query?
if($result = mysql_query($queryitem)) {
// If there are results returned, prepare combo-box
if($success = mysql_num_rows($result) > 0) {
// Start combo-box
echo "<select name='item'>\n";
echo "<option>-- Select Item --</option>\n";
// For each item in the results...
while ($row = mysql_fetch_array($result))
// Add a new option to the combo-box
echo "<option value='$row[item]'>$row[item]</option>\n";
// End the combo-box
echo "</select>\n";
}
// No results found in the database
else { echo "No results found."; }
}
// Error in the database
else { echo "Failed to connect to database."; }
// Add a submit button to the form
echo "<input type='submit' value='Submit' /></form>";
}
?>
Tags: code, combo-box, drop-down box, mysql, PHP
Posted in iD Tech Bloggers | 2 Comments »
iD Summer Camp Staff Retention: 65 Percent!
When you choose your child’s summer camp, you want staff and instructors who are knowledgeable, caring, professionally-trained and FUN! As a family company, we place huge importance on hiring, training and retaining only the best staff. Other summer camps may boast these features in their summer staff, but few can say they have a staff return rate of 65 percent. iD Tech Camps can. This is the iD Difference.
iD Tech Camps recruits tech savvy, passionate staff from the nation’s top institutions including UCLA, MIT, Stanford, UT Austin, NYU & more!
Our goal is to ensure that every location is comprised of experienced, returning summer camp staff along with new individuals who bring a fresh perspective and energy to camp. Our staff knows that when they get to camp, they will be working alongside the best in the industry. We interview thousands of candidates each year – but only those applicants who meet our strict criteria are chosen. Next, staff are required to pass strict guidelines and attend in-person trainings. Much of the success of iD Tech Camps we attribute directly to our careful staff selection process and comprehensive training.
“Our hiring process is one of the most strict I’ve seen in the entire summer camp industry,” said Kate DeHart, Human Resources Manager at iD Tech Camps. “We hire adult-only staff and we conduct criminal background checks, multiple reference checks and require valid CPR & First Aid certification and in-person training of our staff members. We work hard with risk management specialists to anticipate problems before they even arise. That’s no small feat!”
A 65 percent summer camp staff return rate means our staff is committed to providing an amazing experience for your kids. Staff retention-like camper retention-means we’re doing something right. How we teach is a big factor.
iD Tech Camps provides some of the best camper-to-instructor ratios, with an average of 6:1. The small class size allows campers the individual attention necessary to thrive in their chosen course(s) and the opportunity to complete an impressive project by the end of the week. Instructors then get the opportunity to bond with their campers and create lasting memories that encourage, inspire and drive campers to do something big with what they learn at camp. We have built our reputation on small ratios. Parents notice. Instructors are inspired. Students are engaged. The quality speaks for itself.
“Everything is really organized and it is obvious iD designs everything around fun and safety,” said Bryan Campbell, an iD Tech Camps Director. “iD is incredibly supportive so it’s reassuring knowing that the staff can reach someone at the iD office anytime 24/7.”
We expect a lot out of our summer staff, therefore we pay them considerably more than other camps. Our staff appreciates the excellent work environment that we provide – high expectations, high pay, periodic evaluations, in-depth curriculum, teaching tools, clear processes and endless summer fun. We train our staff both in person and via the web, and evaluate them consistently. There are even surprise camp visits by the iD staff throughout the summer to ensure that our high standards are being met. By the time camp rolls around, the iD staff is motivated by excellent compensation, thorough training, small class sizes and the knowledge that they are inspiring students to do big things.
Our staff is pleased to work for a professional organization. They want to work for the best. If you choose one summer camp this season, make sure it’s iD. Then sit back, relax and get ready for a summer with stellar instructors who make tech learning fun while enjoying their job. See you this summer!
Tags: best summer camp, summer camp jobs, summer camp staff
Posted in Summer Camps, iD Tech Camps | No Comments »
Web Design Entrepreneur Extraordinaire!
Keeping with our “Do Something Big” theme, Genevieve Anderson came to camp as a 17 year old hoping to learn more about Web Design & Flash® Animation but came away with a lot more. She now is thinking about majoring in Web Design in college! Not only that, she used what she learned at iD Tech Camps to improve her online vintage clothing website.
Read below to learn more about Genevieve and how she’s doing something BIG after having attended our iD Tech Camps.
iD: How many seasons have you attended iD Tech Camps?
Genevieve: This year was my first year!
iD: Where are you from?
G: Roanoke, Virginia
iD: Which iD location did you attend?
G: University of Virginia
iD: What course(s) have you enrolled in?
G: Web Design & Flash Animation
iD: What do you do for fun when you aren’t at our computer camp?
G: Besides high school, I play steel drums, travel abroad and manage my online vintage clothing business with my sisters.
iD: Does coming to iD help you improve in other aspects of your life besides technology?
G: Yes! I learned to be a better leader and to be more independent.
iD: Is iD a good place to make friends? Why?
G: Yes, everyone is very friendly and nice.
iD: What are your future goals? Will you be attending college?
G: I am applying to the University of Virginia, Emerson College, Boston College, Suffolk University in Boston, Columbia College and Roosevelt University in Chicago.
iD: How has iD impacted these goals?
G: I am considering majoring in Web Design.
iD: What’s your favorite tech gadget?
G: My cell phone — I am a teenager!
iD: What’s the #1 way you communicate with your friends?
G: Texting
iD: Why would you keep coming back to iD?
G: Because it’s a fun way to learn and get great website and graphic design advice!
iD: Any advice for future iD Tech campers?
G: Be sure you come prepared to meet new people and have lots of fun while learning some new stuff!
iD: Anything else you’d like to add?
G: Coming to iD Tech Camps helped me so much with the look and function of my online vintage clothing business! Before I came to camp, my website was pretty good. But the counselors really helped me add some great interactive features. I learned how to link pages and added Flash animation to my website. Thanks for everything!
Learn more about other iD Alumni who have gone on to Do Something Big! You can also learn more about our courses and locations.
Tags: computer camps, girls camps, web design camps
Posted in Do Something Big, University of Virginia | No Comments »
Tutorial: Flash Animation for Beginners
Tags: animation, beginners, Flash, tutorial
Posted in Uncategorized, iD Tech Bloggers | 2 Comments »
Orders of Magnitude : Digital Data
Here is a fun breakdown of data nomenclature. I’m sure you are all familiar with the 1st several entries but the latter ones ought to give you a run for your money, ever heard of a petabyte or a yottabyte?
Bit: An eighth of a byte*
This is the smallest fundamental size of data storage. It is a binary digit meaning that it can take the value of either 1 or 0. All computer data can be broken down to a string of these 1 and 0 (like in the Matrix, only it doesn’t fall down the screen like rain). When represented as a string it is called binary code.
Byte: 1 Byte
A single byte stores eight bits*, eight 1’s or 0’s. This octet of bits is the smallest unit for a base 1,000 order of magnitude naming system as follows…
Kilobyte: 1 thousand or, 1,000 bytes
Files not relying on on the kilo prefix are the boring ones, word docs, excel sheets, most pictures.
Megabyte: 1 million, or 1,000,000 bytes
Still pretty lame. Short videos, music. Even a pre-historic floppy disc can store a bunch of these.
Gigabyte: 1 billion, or 1,000,000,000 bytes
Finally respectable. The GB is quickly becoming the standard by which storage capacity is judged as most computer hardware will advertize capacity in terms of GB’s
Terabyte: 1 trillion, or 1,000,000,000,0000 bytes
Currently, hard drive capacity does not exceed this order of magnitude. One terabyte of data can store just under two and a half years of music played continuously. The entire library of congress can be stored on 82 terabytes of data.
Petabye: 1 quadrillion, or 1,000,000,000,000,000 bytes
Now things are getting hardcore. This is the largest order of magnitude which is any single organization claims to have the capacity of and/or handle. All of the user photo’s on Facebook is estimated at close to 1 petabyte of data. Google processes an estimated 20 petabytes of data a day.
Exabyte: 1 quintillion, or 1,000,000,000,000,000,000 bytes
The exabyte is borderline hypothetical at this point. It is theorized that, per month, the entire internet (yeah, lolcats and all) see’s about 5-8 exabytes of traffic. It was proposed that in 2006 all computer data would fit on 160 exabytes of data.
Zettabyte: one sextillion or 1,000,000,000,000,000,000,000
WARNING, WARNING you are now in the DANGER ZONE of data storage capacity. It is estimated that by the year 2010 all digital data in existence will sum up to just under one Zettabyte.
Yottabyte: 1 septillion, or 1,000,000,000,000,000,000,000,000 bytes
Trying to quantify this may make your head explode so you’ll need to sign a release before I go any further.
* a byte can actually be composed of any number of bits, however, eight is standard
As crazy as those names sound, it’s the real deal:
http://en.wikipedia.org/wiki/Units_of_information
Tags: Exabyte, Harddrive, Petabyte, Yottabyte, Zettabyte
Posted in iD Tech Bloggers | No Comments »








