Jump to content

zgkhoo

Members
  • Posts

    507
  • Joined

  • Last visited

    Never

Everything posted by zgkhoo

  1. how to solve this then..i wanna make the text become smaller thanks
  2. after using the where clause ..the query's record still large.. :-\ thanks
  3. PID integer(10), <---i already create an index ....u meant this? or need use others indexing method?
  4. Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 35 bytes) how to solve it? thanks..
  5. $sql = "CREATE TABLE pyrmain ( PID integer(10), Serialnum varchar(10), UplineSerial varchar(10), UplinePID integer(10), Downleft integer(10), LeftSerial varchar(10), Downright integer(10), RightSerial varchar(10), RowNum integer(10), ColumnPosi integer(10), ColumnTotal integer(10), DownlineAmount integer(10), Initial varchar(10), ActivateTime datetime, Status varchar(10), UserID varchar(10), ExpiredDate datetime, CreateDate datetime, Golden varchar(10), Primary Key (PID) )"; mysql_query($sql); table
  6. function setpyramidbonus($cardID,$pyrtable){ echo "</br>enter set pyramid bonus"; $result=mysql_query("SELECT * from $pyrtable ORDER BY PID"); while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ if($row[serialnum]==$cardID){ echo "</br>row upline=".$row[uplineSerial]; $levelcount=1; loopupline($row[uplineSerial],$levelcount,$cardID,$pyrtable); } } very slow n slow n slow for this funciton when the $pyrtable's record is too big which consist of above 10000 record..any solution to deal with large db? thanks
  7. any way/code to show each function use how much time in second? thanks
  8. it can successfully running...but just very slow n slow.. if infinite loop then will hang in there rite? so my page not hang then not infinite issue rite? thanks...
  9. <head> <link rel="stylesheet" type="text/css" href="../../../style.css" /> </head> <div id="bodyarea" style="padding: 1ex 0px 2ex 0px;"> <table width="100%" border="0" cellpadding="0" cellspacing="0" style="padding-top: 1ex;"> <tr> <td width="180" valign="top"> <table border="0" cellpadding="4" cellspacing="1" class="bordercolor" width="674" height="42" align="center"> <tr> <td class="catbg" width="140" height="40"> <div align="center"><a href="/EN/menu/Card/cardmenu.php">Card</a></div> </td> <td class="catbg" width="209" height="40"> <div align="center"><a href="/EN/menu/UserMg/managemenu.php">User Management</a></div> </td> <td class="catbg" width="143" height="40"> <div align="center"><a href="#">Product Management</a></div> </td> <td class="catbg" width="143" height="40"> <div align="center"><a href="#">Status Management</a></div> </td> <td class="catbg" width="143" height="40"> <div align="center"><a href="#">Reward Management</a></div> </td> <td class="catbg" width="143" height="40"> <div align="center"><a href="#">Account Management</a></div> </td> <td class="catbg" width="143" height="40"> <div align="center"><a href="/EN/menu/AdminPass/displayadminpass.php">Change Password</a></div> </td> <td class="catbg" width="143" height="40"> <div align="center"><a href="#">System Management</a></div> </td> <td class="catbg" width="143" height="40"> <div align="center"><a href="/EN/menu/Feedback/fbackmenu.php">Feedback</a></div> </td> <td class="catbg" width="155" height="40"> <div align="center"><a href="/EN/menu/logout.php">Log Out</a></div> </td> </tr> </table> </div> /* Normal, standard links. */ a:link { color: #476C8E; text-decoration: none; } a:visited { color: #476C8E; text-decoration: none; } a:hover { text-decoration: underline; } /* Navigation links - for the link tree. */ .nav, .nav:link, .nav:visited { color: #000000; text-decoration: none; } a.nav:hover { color: #cc3333; text-decoration: underline; } /* Tables should show empty cells. */ table { empty-cells: show; } /* By default (td, body..) use verdana in black. */ body, td, th , tr { color: #000000; font-size: small; font-family: verdana, sans-serif; } /* The main body of the entire forum. */ body { background-color: #E5E5E8; margin: 0px; padding: 12px 30px 4px 30px; } /* Input boxes - just a bit smaller than normal so they align well. */ input, textarea, button { color: #000000; font-family: verdana, sans-serif; } input, button { font-size: 90%; } textarea { font-size: 100%; color: #000000; font-family: verdana, sans-serif; } /* All input elements that are checkboxes or radio buttons. */ input.check { } /* Selects are a bit smaller, because it makes them look even better . */ select { font-size: 90%; font-weight: normal; color: #000000; font-family: verdana, sans-serif; } /* Standard horizontal rule.. ([hr], etc.) */ hr, .hrcolor { height: 1px; border: 0; color: #666666; background-color: #666666; } /* No image should have a border when linked */ a img { border: 0; } /* A quote, perhaps from another post. */ .quote { color: #000000; background-color: #D7DAEC; border: 1px solid #000000; margin: 1px; padding: 1px; font-size: x-small; line-height: 1.4em; } /* A code block - maybe even PHP . */ .code { color: #000000; background-color: #dddddd; font-family: "courier new", "times new roman", monospace; font-size: small; line-height: 1.3em; /* Put a nice border around it. */ border: 1px solid #000000; margin: 1px auto 1px auto; padding: 1px; width: 99%; /* Don't wrap its contents, and show scrollbars. */ white-space: nowrap; overflow: auto; /* Stop after about 24 lines, and just show a scrollbar. */ max-height: 24em; } /* The "Quote:" and "Code:" header parts... */ .quoteheader, .codeheader { color: #000000; text-decoration: none; font-style: normal; font-weight: bold; font-size: x-small; line-height: 1.2em; } /* Generally, those [?] icons. This makes your cursor a help icon. */ .help { cursor: help; } /* /me uses this a lot. (emote, try typing /me in a post.) */ .meaction { color: red; } /* The main post box - this makes it as wide as possible. */ .editor { width: 96%; } /* Highlighted text - such as search results. */ .highlight { background-color: yellow; font-weight: bold; color: black; } /* Alternating backgrounds for posts, and several other sections of the forum. */ .windowbg { color: #000000; background-color: #ECEDF3; } .windowbg2 { color: #000000; background-color: #F6F6F6; } .windowbg3 { color: #000000; background-color: #E0E1E8; } /* the today container in calendar */ .calendar_today { background-color: #FFFFFF; } /* These are used primarily for titles, but also for headers (the row that says what everything in the table is.) */ .titlebg, tr.titlebg th, tr.titlebg td, .titlebg2, tr.titlebg2 th, tr.titlebg2 td { color: black; font-style: normal; background: url(images/titlebg.jpg) #E9F0F6 repeat-x; border-bottom: solid 1px #9BAEBF; border-top: solid 1px #FFFFFF; padding-left: 10px; padding-right: 10px; } .titlebg, .titlebg a:link, .titlebg a:visited { font-weight: bold; color: black; font-style: normal; } .titlebg a:hover { color: #404040; } /* same as titlebg, but used where bold text is not needed */ .titlebg2 a:link, .titlebg2 a:visited { color: black; font-style: normal; text-decoration: underline; } .titlebg2 a:hover { text-decoration: underline; } /* This is used for categories, page indexes, and several other areas in the forum. .catbg and .catbg2 is for boardindex, while .catbg3 is for messageindex and display headers*/ .catbg , tr.catbg td , .catbg3 , tr.catbg3 td { background: url(images/catbg.jpg) #88A6C0 repeat-x; color: #ffffff; padding-left: 10px; padding-right: 10px; } .catbg2 , tr.catbg2 td { background: url(images/catbg2.jpg) #A1BFD9 repeat-x; color: #ffffff; padding-left: 10px; padding-right: 10px; } .catbg, .catbg2, .catbg3 { border-bottom: solid 1px #375576; } .catbg, .catbg2 { font-weight: bold; } .catbg3, tr.catbg3 td, .catbg3 a:link, .catbg3 a:visited { font-size: 95%; color: white; text-decoration: none; } .catbg a:link, .catbg a:visited , .catbg2 a:link, .catbg2 a:visited { color: white; text-decoration: none; } .catbg a:hover, .catbg2 a:hover, .catbg3 a:hover { color: #e0e0ff; } /* This is used for tables that have a grid/border background color (such as the topic listing.) */ .bordercolor { background-color: #ADADAD; padding: 0px; } /* This is used on tables that should just have a border around them. */ .tborder { padding: 1px; border: 1px solid #696969; background-color: #FFFFFF; } /* Default font sizes: small (8pt), normal (10pt), and large (14pt). */ .smalltext { font-size: x-small; font-family: verdana, sans-serif; } .middletext { font-size: 90%; } .normaltext { font-size: small; } .largetext { font-size: large; } /* Posts and personal messages displayed throughout the forum. */ .post, .personalmessage { width: 100%; overflow: auto; line-height: 1.3em; } /* All the signatures used in the forum. If your forum users use Mozilla, Opera, or Safari, you might add max-height here . */ .signature { width: 100%; overflow: auto; padding-bottom: 3px; line-height: 1.3em; } /* Sometimes there will be an error when you post */ .error { color: red; } /* definitions for the main tab, active means the tab reflects which page is displayed */ .maintab_first, .maintab_back, .maintab_last, .maintab_active_first, .maintab_active_back, .maintab_active_last { color: white; text-transform: uppercase; vertical-align: top; } .maintab_back, .maintab_active_back { color: white; text-decoration: none; font-size: 9px; vertical-align: top; padding: 2px 6px 6px 6px; font-family: tahoma, sans-serif; } .maintab_first { background: url(images/maintab_first.gif) left bottom no-repeat; width: 10px; } .maintab_back { background: url(images/maintab_back.gif) left bottom repeat-x; } .maintab_last { background: url(images/maintab_last.gif) left bottom no-repeat; width: 8px; } .maintab_active_first { background: url(images/maintab_active_first.gif) left bottom no-repeat; width: 6px; } .maintab_active_back { background: url(images/maintab_active_back.gif) left bottom repeat-x; } .maintab_active_last { background: url(images/maintab_active_last.gif) left bottom no-repeat; width: 8px; } /* how links behave in main tab. */ .maintab_back a:link , .maintab_back a:visited, .maintab_active_back a:link , .maintab_active_back a:visited { color: white; text-decoration: none; } .maintab_back a:hover, .maintab_active_back a:hover { color: #e0e0ff; text-decoration: none; } /* definitions for the mirror tab */ .mirrortab_first, .mirrortab_back, .mirrortab_last, .mirrortab_active_first, .mirrortab_active_back, .mirrortab_active_last { color: white; text-transform: uppercase; vertical-align: top; } .mirrortab_back, .mirrortab_active_back { color: white; text-decoration: none; font-size: 9px; vertical-align: bottom; padding: 6px 6px 2px 6px; font-family: tahoma, sans-serif; } .mirrortab_first { background: url(images/mirrortab_first.gif) no-repeat; width: 10px; } .mirrortab_back { background: url(images/mirrortab_back.gif) repeat-x; } .mirrortab_last { background: url(images/mirrortab_last.gif) no-repeat; width: 6px; } .mirrortab_active_first { background: url(images/mirrortab_active_first.gif) no-repeat; width: 6px; } .mirrortab_active_back { background: url(images/mirrortab_active_back.gif) repeat-x; } .mirrortab_active_last { background: url(images/mirrortab_active_last.gif) no-repeat; width: 8px; } /* how links behave in mirror tab. */ .mirrortab_back a:link , .mirrortab_back a:visited, .mirrortab_active_back a:link , .mirrortab_active_back a:visited { color: white; text-decoration: none; } .mirrortab_back a:hover, .mirrortab_active_back a:hover { color: #e0e0ff; text-decoration: none; } /* The AJAX notifier */ #ajax_in_progress { background: #4682B4; color: white; text-align: center; font-weight: bold; font-size: 18pt; padding: 3px; width: 100%; position: fixed; top: 0; left: 0; } cant ...the font still big...after i add in #font-size: 1em; at the bottom above is my php file and my css file, these words User Management,Product Management,Status Management,Reward Management still big how? ???
  10. how to make the text size smaller using css? it is ok for font showing in mozilla which is small but when open with i/e then become big..and the menu become too large how to solve? thanks.. [attachment deleted by admin]
  11. mysql_fetch_array can clear the array from buffer after loop? the select * from pyramid =large amount of data consist over 2000 record... is it fetch the array from the above large amount of record query make my program slow? ???
  12. <?php include 'config.php'; include 'opendb.php'; //insert gamecard initial into pyramidass table //echo "<select name=initial>"; $result=mysql_query("SELECT DISTINCT Initial from gamecard ORDER BY Initial"); while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ $existing=0; //echo "<option value=$row[initial] selected='selected'>$row[initial]</option>"; $ID=findid(); //echo "</br>id=".$ID; $result2=mysql_query("SELECT * from pyramidass"); while($row2 = mysql_fetch_array($result2,MYSQL_ASSOC)){ if($row2[initial]==$row[initial]){ $existing=1; // echo "</br>exiting!"; } } if($existing!=1&&!empty($row[initial])){ $sql="INSERT INTO pyramidass(ID,Initial,AssoTable) VALUES ('$ID','$row[initial]','prymain')"; mysql_query($sql); } } // "</br>existing=".$existing; //echo "</select>"; //echo "</form>"; //display the pyramidass table record into a selected box $result=mysql_query("SELECT * from pyramidass ORDER BY ID"); echo "<form action='testing6.php' method='POST'>"; echo "<font>Select The Initial(gamecard) For Check</font>"; echo "<select name=serialini>"; while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ echo "<option value=$row[initial] selected='selected'>$row[iD] $row[initial]</option>"; } echo "</select>"; echo "<input type=submit name=check value=check></input>"; echo "</form>"; //for rate checking $result=mysql_query("SELECT * from rate ORDER BY RID"); echo "<form action='testing6.php' method='POST'>"; echo "<font>Select The rate For Check</font>"; echo "<select name=ratename>"; while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ echo "<option value=$row[RateName] selected='selected'>$row[RID] $row[RateName]</option>"; } echo "</select>"; echo "<input type=submit name=check2 value=check></input>"; echo "</form>"; // if(isset($_POST['button3'])){ //create pyramidass table $sql = "CREATE TABLE rate ( RID integer(10), RateName varchar(10), Rate decimal(6,2), Primary Key(RID) )"; mysql_query($sql); $ID=findrateID(); $sql="INSERT INTO rate(RID,RateName,Rate) VALUES ('$ID','SELL','20')"; mysql_query($sql); $ID=findrateID(); //$sql="INSERT INTO rate(RID,RateName,Rate) // VALUES //('$ID','ACTIVATE','100')"; //mysql_query($sql); $ID=findrateID(); $sql="INSERT INTO rate(RID,RateName,Rate) VALUES ('$ID','PYRAMID','10')"; mysql_query($sql); $ID=findrateID(); $sql="INSERT INTO rate(RID,RateName,Rate) VALUES ('$ID','GP2CP','100')"; mysql_query($sql); } //if create table button clicked if(isset($_POST['button'])){ $new_table = $_POST['tablename']; $sql = "CREATE TABLE $new_table ( PID integer(10), Serialnum varchar(10), UplineSerial varchar(10), UplinePID integer(10), Downleft integer(10), LeftSerial varchar(10), Downright integer(10), RightSerial varchar(10), RowNum integer(10), ColumnPosi integer(10), ColumnTotal integer(10), DownlineAmount integer(10), Initial varchar(10), ActivateTime datetime, Status varchar(10), UserID varchar(10), ExpiredDate datetime, CreateDate datetime, Golden varchar(10), Primary Key (PID) )"; mysql_query($sql); $ID=findpyramidTID(); $sql="INSERT INTO pyramidT(TID,TableName) VALUES ('$ID','$new_table')"; mysql_query($sql); } if(isset($_POST['button2'])){ //create pyramidass table $sql = "CREATE TABLE pyramidass ( ID integer(10), Initial varchar(10), AssoTable varchar(10), Primary Key(ID) )"; mysql_query($sql); //insert default pyramid-pyrmain for else cards. $ID=findid(); $sql="INSERT INTO pyramidass(ID,Initial,AssoTable) VALUES ('$ID','Else','prymain')"; mysql_query($sql); //create pyramidT table $sql = "CREATE TABLE pyramidT ( TID integer(10), TableName varchar(10), Primary Key(TID) )"; mysql_query($sql); //create a default pyramid table $sql = "CREATE TABLE pyrmain ( PID integer(10), Serialnum varchar(10), UplineSerial varchar(10), UplinePID integer(10), Downleft integer(10), LeftSerial varchar(10), Downright integer(10), RightSerial varchar(10), RowNum integer(10), ColumnPosi integer(10), ColumnTotal integer(10), DownlineAmount integer(10), Initial varchar(10), ActivateTime datetime, Status varchar(10), UserID varchar(10), ExpiredDate datetime, CreateDate datetime, Golden varchar(10), Primary Key (PID) )"; mysql_query($sql); $ID=findpyramidTID(); //insert the default pyrmain table into pyramidT $sql="INSERT INTO pyramidT(TID,TableName) VALUES ('$ID','pyrmain')"; mysql_query($sql); } //if check initial asso button is clicked if(isset($_POST['check'])){ //echo "</br>post =".$_POST['serialini']; $result = mysql_query("SELECT * FROM pyramidass ") or die('Query failed: ' . mysql_error()); echo "<form action=testing6.php method=post>"; echo "<table>"; echo "<tr>"; while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ if ($_POST['serialini']==$row['Initial']){ // echo "</br>post =".$_POST['serialini']; // echo "</br>row=".$row['Initial']; // echo "</br>".$row['ID'].$row['Initial'].$row['AssoTable']; echo " <tr> <td>ID</td> <td><input type='text' name='id' value=$row[iD] readonly></td> </tr> <tr> <td>Initial</td> <td><input type='text' name='initial' value=$row[initial] readonly></td> </tr> <tr> <td>Associated Table</td> <td><select name=assotable>"; $result2 = mysql_query("SELECT * FROM pyramidT") or die('Query failed: ' . mysql_error()); while($row2 = mysql_fetch_array($result2,MYSQL_ASSOC)){ //echo"<td><input type='text' name='assotable' value=$row2[AssoTable]></td>"; //echo "<option value=$row[AssoTable] selected='selected'>$row[AssoTable]</option>"; if($row[AssoTable]==$row2[TableName]){ echo "<option value=$row2[TableName] selected='selected'>$row2[TableName]</option>"; } else{ echo "<option value=$row2[TableName]>$row2[TableName]</option>"; } }//end while echo "</select>"; echo "</td>"; echo "</tr>"; }//end if }//end while echo "<tr><td><input type=submit name=change value=change></td></tr>"; echo "</table>"; echo "</form>"; } if(isset($_POST['check2'])){ //echo "</br>post =".$_POST['serialini']; $result = mysql_query("SELECT * FROM rate ") or die('Query failed: ' . mysql_error()); echo "<form action=testing6.php method=post>"; echo "<table>"; echo "<tr>"; while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ if ($_POST['ratename']==$row['RateName']){ // echo "</br>post =".$_POST['serialini']; // echo "</br>row=".$row['Initial']; // echo "</br>".$row['ID'].$row['Initial'].$row['AssoTable']; echo " <tr> <td>ID</td> <td><input type='text' name='rid' value=$row[RID] readonly></td> </tr> <tr> <td>Initial</td> <td><input type='text' name='initial' value=$row[RateName] readonly></td> </tr> <tr> <td>Rate</td> <td><input type='text' name='rate' value=$row[Rate]></td> <!--<td><select name=rateamount>-->"; // $result2 = mysql_query("SELECT * FROM rate ORDER BY RID") or die('Query failed: ' . mysql_error()); // while($row2 = mysql_fetch_array($result2,MYSQL_ASSOC)){ //echo"<td><input type='text' name='assotable' value=$row2[AssoTable]></td>"; //echo "<option value=$row[AssoTable] selected='selected'>$row[AssoTable]</option>"; // if($row[Rate]==$row2[Rate]){ //echo "<option value=$row2[Rate] selected='selected'>$row2[Rate]</option>"; // } // else{ // echo "<option value=$row2[Rate]>$row2[Rate]</option>"; // } }//end while // echo "</select>"; echo "</tr>"; //}//end if }//end while echo "<tr><td><input type=submit name=changerate value=changerate></td></tr>"; echo "</table>"; echo "</form>"; } if(isset($_POST['change'])){ mysql_query("UPDATE pyramidass SET AssoTable = '$_POST[assotable]' where ID='$_POST[id]'"); } if(isset($_POST['changerate'])){ mysql_query("UPDATE rate SET Rate = '$_POST[rate]' where RID='$_POST[rid]'"); } function findid(){ $result=mysql_query("SELECT * from pyramidass ORDER BY ID"); if(mysql_num_rows($result)==0){ return 1001; }//end if else{ while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ $ID=$row[iD]; }//end while return $ID+1; }//end else } function findrateID(){ $result=mysql_query("SELECT * from rate ORDER BY RID"); if(mysql_num_rows($result)==0){ return 1001; }//end if else{ while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ $ID=$row[RID]; }//end while return $ID+1; }//end else } function findpyramidTID(){ $result=mysql_query("SELECT * from pyramidT ORDER BY TID"); if(mysql_num_rows($result)==0){ return 1001; }//end if else{ while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ $id=$row[GpTID]; }//end while return $id+1; }//end else } //insert admin card module!!!!!!!!!!!!! if(isset($_POST['insertadmincard'])){ //store admin card into gamecard table $result=mysql_query("SELECT * from rate ORDER BY RID"); //while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ for($i=0,$count=$_POST['admincardnum'];$i<$count;$i++) { $ID="AAA".$i; $sql="INSERT INTO gamecard(Serialnum,Serial,Ownerid) VALUES ('$ID','$i','AdminCard')"; mysql_query($sql); //$pyrtable=findpyramid($ID); $prytable=$_POST['assotable']; echo "</br>prytable=".$_POST['assotable']; addpyramidcard($ID,$_POST['assotable']); //setpyramidbonus($row[serialnum],$pyrtable); } } //start into pyramid module!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //start into pyramid module!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //start into pyramid module!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //insert into pyramid module...!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! function addpyramidcard($cardID,$pyrtable){ //global $pyrtable; echo "</br><font color=red>cardID to add in pyramid=</font>".$cardID; echo "</br>Pyramid table to save=".$pyrtable; //find the lastpid in dbstore $lastID=findlastPID($pyrtable); //find the lastrownum for pyramid in dbstore $lastRowNum=findlastRowNum($pyrtable); //find the lastcolumntotal for latest row for pyramid in dbstore $lastColumnTotal=findlastColumnTotal($pyrtable); //calculate the current rows's limit //display all three variable echo "</br><font color=red>PID to be save=</font>".$lastID; echo "</br>lastrownum(Row's element limit)=".$lastRowNum; echo "</br>lastcolumnTotal(last column posi)=".$lastColumnTotal; //echo "</br>Pyramid table status=".checkpyramidlastrow($pyrtable); //if columntotal is less than row limit if($lastColumnTotal<$lastRowNum) { echo "</br></br><font color=red>enter first(pyramid not full)</font>"; //updatelastColumnTotal(); //$lastColumnTotal=findlastColumnTotal(); $Columnposi=findColumnPosi($lastRowNum,$pyrtable); $uplineid=findupline($Columnposi,$lastRowNum,$lastID,$cardID,$pyrtable); $uplineSerial=finduplineserial($Columnposi,$lastRowNum,$lastID,$pyrtable); echo "</br>Pyramid UPLINE CARD ID=".$uplineid; echo "</br>Pyramid UPLINE Serial=".$uplineSerial; echo "</br><font color=red>RowNum to be save=</font>".$lastRowNum; echo "</br><font color=red>Column position to save=</font>".$Columnposi; $userID=findcarduser($cardID); $sql="INSERT INTO $pyrtable(PID,Serialnum,RowNum,ColumnPosi,UplineSerial,UplinePID,UserID) VALUES ('$lastID','$cardID','$lastRowNum','$Columnposi','$uplineSerial','$uplineid','$userID')"; mysql_query($sql); // updatelastPID(); }//end if //if the columntotal is equal with the rowlimit //if columntotal is reach the row limit else{ echo "</br>enter second(pyramid full)"; //resetlastColumnTotal(); //updatelastColumnTotal(); //updatelastRowNum(); $lastRowNum=findlastRowNum($pyrtable); $lastRowNum=$lastRowNum*2; $lastColumnTotal=0; $Columnposi=findColumnPosi($lastRowNum,$pyrtable); $uplineid=findupline($Columnposi,$lastRowNum,$lastID,$cardID,$pyrtable); $uplineSerial=finduplineserial($Columnposi,$lastRowNum,$lastID,$pyrtable); echo "</br>Pyramid UPLINE CARD ID=".$uplineid; echo "</br>Pyramid UPLINE Serial=".$uplineSerial; echo "</br>RowNum to be save=".$lastRowNum; echo "</br>Column position to save=".$Columnposi; $userID=findcarduser($cardID); $sql="INSERT INTO $pyrtable(PID,Serialnum,RowNum,ColumnPosi,UplineSerial,UplinePID,UserID) VALUES ('$lastID','$cardID','$lastRowNum','$Columnposi','$uplineSerial','$uplineid','$userID')"; mysql_query($sql); // updatelastPID(); }//end else }//end function function lastGpTID(){ $result=mysql_query("SELECT * from gptran ORDER BY GpTID"); if(mysql_num_rows($result)==0){ return 1001; }//end if else{ while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ $Gptid=$row[GpTID]; }//end while return $Gptid+1; }//end else } //find the last pid function findlastPID($pyrtable) { $pyrtable; $result=mysql_query("SELECT * from $pyrtable ORDER BY PID"); if(mysql_num_rows($result)==0){ return 1001; } else{ while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ $pid=$row[PID]; }//end while return $pid+1; }//end else }//end function //find the lastrownum function findlastRowNum($pyrtable) { //echo "</br>enter findlastRowNum()"; $result=mysql_query("SELECT from $pyrtable ORDER BY PID"); if(mysql_num_rows($result)==0){ return 1; }//end if else{ while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ $rownum=$row[RowNum]; } return $rownum; } } //find the last columntotal function findlastColumnTotal($pyrtable) { $result=mysql_query("SELECT * from $pyrtable ORDER BY PID"); //echo "</br>enter findlastColumnTotal()"; if(mysql_num_rows($result)==0){ return 0; }//end if else{ while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ $columnposi=$row[ColumnPosi]; } return $columnposi; } } function findColumnPosi($lastRowNum,$pyrtable){ //find which column position number for record to save //echo "</br>enter findColumnPosi()"; //echo "</br>last row num=".$lastRowNum; for($i=0;$i<=$lastRowNum-1;$i++){ $a[$i] = $i+1; } //print_r($a); //echo "</br>new array=</br>"; $b = new_order($a); // print "<PRE>"; // print_r($b); // print "</PRE>"; //find the current blank position for the same rownum for($i=0;$i<=$lastRowNum-1;$i++){ // echo "</br><font color=red>enter for loop i=</font>".$b[$i]; $result=mysql_query("SELECT * from $pyrtable WHERE RowNum=$lastRowNum"); $found=0; while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ // echo "<br>while loop column num in DB=".$row[ColumnPosi]; //echo "</br>with Array=".$b[$i]; if($row[ColumnPosi]==$b[$i])//if column num already got the record { $found=1; }//end if else{ }//end else }//end while if($found==1){ //echo "</br>found=======================".$b[$i]; } else{ // echo "</br>save in=======================".$b[$i]; return $b[$i]; } }//end of for loop } //function for calculate the new columnposi number for the new card function new_order($a){ $out = array(); $n = count($a) / 2; foreach ($a as $k => $v){ $m = $n; $newk = 0; while ($k > 0){ $newk += ($k % 2) * $m; $k = (int) $k / 2; $m = $m / 2; } $out[$newk] = $v; } ksort($out); return $out; } function findupline($downline,$rowtotal,$downlineID,$cardID,$pyrtable){ $upline=round($downline/2); $uprow=$rowtotal/2; echo "</br></font color=green>upline(pyramid)'s Column Posi=</font>".$upline; echo "</br></font color=green>upline(pyramid)'s RowNum=</font>".$uprow; $result=mysql_query("SELECT * from $pyrtable WHERE RowNum=$uprow"); while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ if($row[ColumnPosi]==$upline){ if($downline/2!=$upline){ mysql_query("UPDATE $pyrtable SET Downleft= '$downlineID',LeftSerial='$cardID' WHERE PID = '$row[PID]'") or die(mysql_error()); } else{ mysql_query("UPDATE $pyrtable SET Downright= '$downlineID',RightSerial='$cardID' WHERE PID = '$row[PID]'") or die(mysql_error()); } echo "</br>upline(pyramid)[PID]=".$row[PID]; return $row[PID]; } } } function setpyramidbonus($cardID,$pyrtable){ echo "</br>enter set pyramid bonus"; $result=mysql_query("SELECT * from $pyrtable ORDER BY PID"); while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ if($row[serialnum]==$cardID){ echo "</br>row upline=".$row[uplineSerial]; $levelcount=1; loopupline($row[uplineSerial],$levelcount,$cardID,$pyrtable); } } } function loopupline($upline2,$levelcount,$cardserial2,$pyrtable) { echo "</br></br>"; echo "</br><font color=purple>Enter loop(pyramid upline bonus) function</font>"; //echo "</br>upline2=".$upline2; echo "</br>Level Count=".$levelcount; $rate=findrate('PYRAMID'); //echo "</br>pyramid rate=".$rate; // if($levelcount==1){ // $cardserial2=$upline2; // } $result2=mysql_query("SELECT * from $pyrtable ORDER BY PID"); while($row2 = mysql_fetch_array($result2,MYSQL_ASSOC)){ if($row2[serialnum]==$upline2){ echo "</br><font color=green>start searching upline record in pyramid</font>"; //echo "</br>upline2=".$upline2; echo "</br><font color=red>Serialnum=</font>".$row2[serialnum]; $lastID=lastGpTID(); $userID=findcarduser($upline2); echo "</br>userid=".$userID; $sql="INSERT INTO gptran (GpTID,TranDate,Mode,CardSerial,BenefitFrom,BenefitFlevel,TranPoint,Purpose,FromWhere,ToWhere,UserID) VALUES ('$lastID',NOW(),'Credit','$row2[serialnum]','$cardserial2','$levelcount','$rate','PRYRAMID BONUS','CompanyPoint','UserPoint','$userID')"; mysql_query($sql); //$lastID+=1; // mysql_query("UPDATE dbstore SET LastGpTID='$lastID'") or die(mysql_error());//increase gptid if($upline2!='0'&&$levelcount<11){ $upline2=$row2[uplineSerial]; $levelcount=$levelcount+1; echo "</br><font color=blue>upline serialnum to be loop=</font>".$upline2; //echo "</br><font color=blue>upline serial before loop=</font>".$row2[uplineSerial]; loopupline($upline2,$levelcount,$cardserial2,$pyrtable); }//end if } if($upline2=='0'){ echo "</br><font color=red>end</font>"; }//end if }//end while }//end function function finduplineserial($downline,$rowtotal,$downlineID,$pyrtable){ $upline=round($downline/2); $uprow=$rowtotal/2; //echo "</br>upline column posi".$upline; //echo "</br>upline row=".$uprow; $result=mysql_query("SELECT * from $pyrtable WHERE RowNum=$uprow"); while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ if($row[ColumnPosi]==$upline){ return $row[serialnum]; } } } function setsellcardbonus($upline,$downline){ $lastID=lastGpTID(); $userID=findcarduser($upline); $rate=findrate('SELL'); //echo "sell rate=".$rate; $sql="INSERT INTO gptran (GpTID,UserID,TranDate,Mode,CardSerial,BenefitFrom,BenefitFlevel,TranPoint,Purpose,FromWhere,ToWhere) VALUES ('$lastID','$userID',NOW(),'Credit','$upline','$downline','1',$rate,'SELL CARD','CompanyPoint','UserPoint')"; mysql_query($sql); // $lastID+=1; // mysql_query("UPDATE dbstore SET LastGpTID='$lastID'") or die(mysql_error());//increase gptid } function setbuycardbonus($cardID){ $lastID=lastGpTID(); $userID=findcarduser($cardID); $rate=findcardpoint($cardID); //echo "activate card rate=".$rate; $sql="INSERT INTO gptran (GpTID,UserID,TranDate,Mode,CardSerial,BenefitFrom,BenefitFlevel,TranPoint,Purpose,FromWhere,ToWhere) VALUES ('$lastID','$userID',NOW(),'Credit','$cardID','$cardID','1',$rate,'ACTIVATE CARD','CompanyPoint','UserPoint')"; mysql_query($sql); $lastID+=1; mysql_query("UPDATE dbstore SET LastGpTID='$lastID'") or die(mysql_error());//increase gptid } function findpyramid($cardID){ //find initial $result=mysql_query("SELECT * from gamecard ORDER BY Serial"); while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ if($row[serialnum]==$cardID){ $initial=$row[initial]; } } if(empty($initial)){ $initial='Else'; } $result2=mysql_query("SELECT * from pyramidass ORDER BY ID"); while($row2 = mysql_fetch_array($result2,MYSQL_ASSOC)){ if($row2[initial]==$initial){ return $row2[AssoTable]; }//end if }//end while }//function function findcarduser($ID){ //echo "</br>enter find car user"; $result=mysql_query("SELECT * from gamecard ORDER BY Serial"); while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ if($row[serialnum]==$ID){ //echo "</br>valid find card user"; //echo "</br>UserID for this card=".$row[Ownerid]; return $row[Ownerid]; } } } function checkpyramidlastrow($pyrtable){ $result=mysql_query("SELECT * from $pyrtable ORDER BY PID"); if(mysql_num_rows($result)==0){ return "blank"; } else{ while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ if($row[RowNum]==$row[ColumnPosi]){ $status="full"; } else{ $status="notfull"; } } return $status; } } function findrate($mode){ $result=mysql_query("SELECT * from rate ORDER BY RID"); while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ if($row[RateName]==$mode){ return $row[Rate]; } } } function findcardpoint($cardID){ $result=mysql_query("SELECT * from gamecard ORDER BY Serial"); while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ if($row[serialnum]==$cardID){ return $row[Point]; } } } include 'closedb.php'; ?> <html> <head> <link rel="stylesheet" type="text/css" href="style.css"/> </head> <form name='createtable' action='testing6.php' method=post> <table border="3"> <tr> <td>new pyramid table name</td> <td><input type="text" name=tablename><td> </tr> <tr> <td><input type="submit" name='button' value='create'><td> </tr> <tr> <td><input type="submit" name='button2' value='create pyramid table list'><td> </tr> <tr> <td><input type="submit" name='button3' value='create rate '><td> </tr> </table> </form> <form name='insertadmincard' action='testing6.php' method=post> <table border="3"> <tr> <td>Number of Admin card to be insert into pyramid</td> <td><input type="text" name=admincardnum></td> </tr> <tr> <td>Select which pyramid table to be insert</td> <td><select name=assotable> <?php include 'config.php'; include 'opendb.php'; $result2 = mysql_query("SELECT * FROM pyramidT") or die('Query failed: ' . mysql_error()); while($row2 = mysql_fetch_array($result2,MYSQL_ASSOC)){ if($row[AssoTable]==$row2[TableName]){ echo "<option value=$row2[TableName] selected='selected'>$row2[TableName]</option>"; }//end if else{ echo "<option value=$row2[TableName]>$row2[TableName]</option>"; }//end else }//end while include 'closedb.php'; ?> </select> </td> </tr> <tr> <td><input type="submit" name='insertadmincard' value='insert'><td> </tr> </table> </form> </html> the page that cause the lag n lag n lag....any problem with the above page? thanks
  13. 1) You can modify the script to deal with less data, or at least handle it more efficiently memory-wise. how for the above script? as i cant minus the array amount.. ??? ??? headace how many GB memory required? 4GB? i just test it on my own then already hang...wat if 20 ppl log in and use the above function? oh my god..really cant think any solution... :-\ :-\
  14. function new_order($a){ $out = array(); $n = count($a) / 2; foreach ($a as $k => $v){ $m = $n; $newk = 0; while ($k > 0){ $newk += ($k % 2) * $m; $k = (int) $k / 2; $m = $m / 2; } $out[$newk] = $v; } ksort($out); return $out; } when the array is huge.eg 1024 or 2048 or above binary amount of array.. then my pc..hang .....my processor usage going to 100%.. any solution?? :-\
  15. still the same ... ??? ??? ??? is it need to change this too? ; Maximum time (in secondes) for connect timeout. -1 means no limit mysql.connect_timeout = 0
  16. already change the maximum execute time in php.ini ;;;;;;;;;;;;;;;;;;; ; Resource Limits ; ;;;;;;;;;;;;;;;;;;; max_execution_time = 60000 ; Maximum execution time of each script, in seconds max_input_time = 600000 ; Maximum amount of time each script may spend parsing request data memory_limit = 16M ; Maximum amount of memory a script may consume (16MB) but still come out this error msg Fatal error: Maximum execution time of 60 seconds exceeded in D:\xampplite\htdocs\testing6.php on line 745
  17. offset setting? wats that? how to set? thanks
  18. $result=mysql_query("SELECT DISTINCT Initial from gamecard ORDER BY Initial"); how to ignore/skip the null value? thanks
  19. no different..cos i wanna backup each male/female in different db/table
  20. <td><input type='text' name='id' value=$row[iD]></td>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.