Hosting Solutions
mobile_logo Table of Contents
seal_frontseal_back

Experience Level Evaluation Programming Tutorial

Learn to use PHP to tally up user Experience Level from any number stored or derived from a MySQL database, and render graphics and amounts accordingly. Can be used for games or web site programming. You can easily adjust all numbers to fit your system level ascension scale. <?php // Connect to your database like you normally do, then get any value into the $count variable $username = "Jeremy"; $count = 287; $lvl = 1; if ($count >= 12800) { $lvl = 10; } else if ($count >= 6400) { $lvl = 9; } else if ($count >= 3200) { $lvl = 8; } else if ($count >= 1600) { $lvl = 7; } else if ($count >= 800) { $lvl = 6; } else if ($count >= 400) { $lvl = 5; } else if ($count >= 200) { $lvl = 4; } else if ($count >= 100) { $lvl = 3; } else if ($count >= 50) { $lvl = 2; } // Render stars or any graphics/images according to dynamic $lvl number $stars = ""; $i = 1; while ($i <= $lvl) { $stars .= "&#9733;"; $i++; } echo "$stars<br />$username is level $lvl with $count experience points"; ?>
thumb

PHP Videos

Miscellaneous

Website Design Theme Application PHP Cookies CSS TutorialPDO Prepared Statements PHP TutorialPDO Tutorial Connect Database and Query ExampleActive Page Link Button Highlight TutorialGeoPlugin Tutorial Get User Location Information IP DetectionHashtag System and Regex PHP Programming TutorialPagination MySQLi Google Style Paged Results TutorialActive Clickable Link Function preg_replace Programming TutorialGet Favicon From Web Site Link Access External FilesRandom String Generator PHP Function Programming TutorialForce File Download Dialog In Browser TutorialCheck User Sign Up Name Ajax PHP Social Network TutorialFlat File Text Database System CMS Edit Content TutorialFlat File Text Database System Display ContentExperience Level Evaluation Programming TutorialStagger and Limit Dynamic Output in a While Loop Google AdsTwitter Dynamic Goodies Widget TutorialDynamic Google Maps Location TutorialPrepared Statements PHP mysqli Tutorial