OSdata.com |
Building a game open source code This is the actual source code from a new web game. See the game at thissideofsanity.com and read how this was built starting at example code.
This is example code from the SlamZee project and This Side of Sanity, released under Apache License 2.0.
Copyright 2013 Milo (for software), Distribution and website handled by Strazbick.com
Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
This narrative uses anchor links so that you can follow the building of this software in chronological order. Go to software explanation to start reading. Go to thissideofsanity.com to see the working software.
This is example code from the SlamZee project and This Side of Sanity, released under Apache License 2.0.
This code loops through the data base on the top 21 most slammed celebrities.
<?php require_once('./php/databasefunctions.php'); ?> <table style="border-width:8px;border-color:#ff0000;color:black;" align="center" border="2"> <tr><th align="center" colspan="3"><big>21 most slammed celebrities</big></th></tr> <?php $result = ConnectCelebDataBase(0); /* located in /php/databasefunctions.php */ /* GATHER 21 MOST HATED CELEBRITIES */ $celebritycount = 1; /* initializing for outputting rank numbers */ $rowcounter = 1; /* initializing for outputting three to a row */ $query = 'SELECT celebnum,mainname,votecount,96picture FROM celebrity ORDER BY votecount DESC LIMIT 21'; $celeblistresult = mysql_query($query); if ($celeblistresult) { while ( $row = mysql_fetch_array($celeblistresult) ) { /* note that I am mixing computation and display -- bad, bad me */ $celebnum = $row["celebnum"]; $celebname = $row["mainname"]; $votecount = $row["votecount"]; $picture96 = $row["96picture"]; if ($rowcounter == 1) { echo '<tr align="left" valign="top">'; } /* END IF first box in row */ echo '<td><small>'.$celebname.'<br>'.$votecount.'</small><br>'; if ($picture96 != '') echo '<img src="./cpict/'.$picture96.'" width="96" height="96" align="left">'; else echo '<img src="./testpict/blankpicture.png" width="96" height="96" align="left">'; echo '</td>'; if ($rowcounter == 3) { echo '</tr>'; } /* END IF first box in row */ $celebritycount = $celebritycount + 1; $rowcounter = $rowcounter + 1; if ($rowcounter >= 4) $rowcounter = 1; } /* END WHILE fetching a single row */ } /* END IF valid SQL result */ ?> </table> <h1 align="center"><a href="javascript:void(0);" onclick="temptingswitch = true;" style="cursor:pointer;">start slamming now!</a></h1> <?php ?>
OSdata.com is used in more than 300 colleges and universities around the worldFind out how to get similar high web traffic and search engine placement. |
OSdata.com is used in more than 300 colleges and universities around the world |
Tweets by @osdata |
A web site on dozens of operating systems simply cant be maintained by one person. This is a cooperative effort. If you spot an error in fact, grammar, syntax, or spelling, or a broken link, or have additional information, commentary, or constructive criticism, please e-mail Milo. If you have any extra copies of docs, manuals, or other materials that can assist in accuracy and completeness, please send them to Milo, PO Box 1361, Tustin, CA, USA, 92781.
Click here for our privacy policy.
previous page | next page |
This web site handcrafted on Macintosh computers using Tom Benders Tex-Edit Plus and served using FreeBSD .
Names and logos of various OSs are trademarks of their respective owners.
Copyright © 2013 Milo
Last Updated: October 18, 2013
Created: September 21, 2013
previous page | next page |