MLM Hand Level Programming Introduction: In our modern MLM business policy you have seen that new member always come through one referral and the newly registered member will go the ‘Referral’ bottom line. In this problem we have to figure out the PHP code snippet and the Database design so that we can track everything and we can show the hand level output for each user. Problem: Suppose ‘A’ is the director of ‘I-Media’. He has now …
Tag: PHP
To show any specific length of a strings in PHP we can use the following functions. function excerpt($str, $length=10, $trailing=’…’) { /* ** $str -String to truncate ** $length – length to truncate ** $trailing – the trailing character, default: “…” */ // take off chars for the trailing $length-=mb_strlen($trailing); if (mb_strlen($str)> $length) { // string exceeded length, truncate and add trailing dots return mb_substr($str,0,$length).$trailing; } else { // string was already short enough, return the string $res = $str; …
To remove all the HTML tags from your PHP string we can easily use strip_tags ($YourStrings) or preg_replace ('/<[^>]*>/', '', $YourStrings) [adsense_id=”2″]
Sometimes we need to decode HTML entities from any specific strings in PHP. Basically it’s more used for retrieve HTML entities from a MySQL cell.? To Convert all HTML entities to their applicable characters there is one function available that is called html_entity_decode(). html_entity_decode($YourStrings) Example: <?php $orig?=?"I'll?"love"?the?<b>girl</b> very much"; $a?=?htmlentities($orig); $b?=?html_entity_decode($a); echo?$a;?//?I'll?"love"?the?<b>girl</b> very much echo?$b;?//?I'll?"love"?the?<b>girl</b> very much?>
When you will work with your Blog or something in PHP, MySQL. Then your user may enter apostrophe s (‘s) into the post writing area. Then it will cause a problem for executing your MySQL Query. To execute your query for MySQL you can use mysql_real_escape_string($yourStrings). Example: <form method=”post” action=””> <input type=”text” name=”user_name” value=”wallpaperama’s”> <br /> <br /> <input type=”submit” name=”Submit” value=”Submit”> </form> <?php $user_name = mysql_real_escape_string ($_POST[‘user_name’]); ?> and write your mysql query. It will be executed without any …