Jump to content

genzedu777

Members
  • Posts

    266
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

genzedu777's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Hi, I need some help here. I wld like to make active radio button on my ratings, but cant seem to get it. Appreciate anyone advice These are my codes <div style="margin-top: 10px;"> <span class="match_header">Arrange by</span> <label for="sort_tutor_total_rating"><input type="radio" name="sort" value="rating" id="sort_tutor_total_rating" <?php if($sort == 'rating'){ ?> checked="checked" <?php } ?> />Ratings</label> <label for="sort_tutor_rank"><input type="radio" name="sort" value="ranking" id="sort_tutor_rank" <?php if($sort == 'ranking'){ ?> checked="checked" <?php } ?> />Ranking</label> <label for="sort_tutor_assignment"><input type="radio" name="sort" value="assignments" id="sort_tutor_assignment" <?php if($sort == 'assignments'){ ?> checked="checked" <?php } ?> />Assignments</label> <label for="sort_tutor_id"><input type="radio" name="sort" value="join_date" id="sort_tutor_id" <?php if($sort == 'join_date'){ ?> checked="checked" <?php } ?> />Date Joined</label> </div> Picture.doc
  2. Hi all, I need help in setting multiple if commands in microsoft excel 2010. However after setting more than 2 IF commands, the system prompted me Tiers Equation Interest Rate 1st 20k Next 20k (20 - 40) Next 20k (40 - 60) Next 20k (60 - 80) More than 80k 1st 20k 20000 0.006 ADD INTEREST Next 20k 20001 40000 0.006 $ 120.00 ADD INTEREST Next 20k 40001 60000 0.005 $ 120.00 $ 100.00 ADD INTEREST Next 20k 60001 80000 0.005 $ 120.00 $ 100.00 $ 100.00 ADD INTEREST 80001 777494 0.005 $ 120.00 $ 100.00 $ 100.00 $ 100.00 ADD INTEREST Unlimited 777494 $3,818.189 Code =IF(D17<$B$5,(D17*$D$5),IF(AND(D17>=B6, D17<=C6),(((D17-20000)*D6)+E6))IF(AND(D17>=B6, D17<=C6),(((D17-20000)*D6)+E6))) "You have entered too many arguments for this function. To get help with this function, click OK to close this message. Then click the Insert Function button located to the left of the equal sign in your formula" And I seriously do not know how to use the Function command. It is unlike excel 2003, where it allows multiple IF commands. Need help here. Thanks
  3. Sorry, I really dont have much knowledge about this I see, so framework is actually practise among programmers?
  4. Hi guys, I just have a simple question. Recently I have come across framework, and realised from a few programmers that they are using Framework to assist them in creating websites, and it seems like most of the codes are provided. My question is, if framework is so useful, why are there still people coding from scratch? Thanks
  5. Hi mjdamato, The answer is yes. Appreciate your next advice. Perhaps you can take a look at our registration form, with that you might have a better understanding. http://www.championtutor.com/tutor_registration3.php Thanks
  6. Hi all, It always happens, after posting a few more follow-up answers, everyone stops replying me. It really makes me wonder, if my question is too complex or my explanation is vague. And if it is vague, I really don't mind explaining further...but please reply me. I need to submit my first phase project very soon. Thank you!!!
  7. Hi mjdamato, Please allow me to explain. There is a purpose for it when we conduct a search throughout our database, as there are at times companies would approach us for 'Pre-School' tutors irregardless of the teaching subjects. Hence, to have the levels' values checked is important to us. I have dropped you an enquiry in another thread to ask you about the functionality of using 2 while loops. It will be of great help if you can shed some light in that thread. I have been stucked for almost a week already. Thank you very much
  8. Hi mjdamato, Is it possible to help me out with these 2 while loops? I am still trying to figure out what had happened. I realised what is left in $subject_data = array(); is only the last value. For example, in subject_data array, there should be 3 values...Eng, Math and Sci However at the end day, subject_data array only keeps 'Sci', the other 2 subjects are missing - 'Eng', 'Math'. It seems like somehow it has been overwritten. I have done some troubleshooting, and realised it is only when I execute the 2nd while loop, while ($data1 = mysqli_fetch_array($sql1)), it will overwrite the values in subject_data array Do I need to store the results/values in subject_data array somewhere in another variable, before executing the 2nd while loop? while($data = mysqli_fetch_array($sql)) //Iterate throug the DB results { if($current_level_id != $data['level_id']) //Determine if this level is different from the last { $levelCheckboxes .= createLevelCheckboxes($subject_data, $level_data 5); $current_level_id = $data['level_id']; $subject_data = array(); } //Add the current record to the $level_data array $subject_data[] = $data; } //$checkboxes .= createLevelCheckboxes($subject_data, $level_data, 5); while($data1 = mysqli_fetch_array($sql1)) { $levelCheckboxes .= createLevelCheckboxes($subject_data, $level_data, 5); $level_data = array(); $level_data[] = $data1; } //Call the createLevelCheckboxes() function to generate the HTML for the LAST level records $levelCheckboxes .= createLevelCheckboxes($subject_data, $level_data, 5);
  9. Hi Nightslyr, I understand that in the 1st while loop, somehow the array will only keep the last value...so I am thinking if there is anyway that I can work it out to what I want to achieve. This is my query $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) or die(mysqli_error($dbc)); //Run query $tutor_id = mysqli_real_escape_string($dbc, $_GET['tutor_id']); $query = "SELECT tl.level_id, tl.level_name, ts.subject_id, ts.subject_name, tsl.subject_level_id, IF(tosl.tutor_id='{$tutor_id}', 1, 0) as checked FROM tutor_level AS tl INNER JOIN tutor_subject_level AS tsl USING (level_id) INNER JOIN tutor_subject AS ts USING (subject_id) LEFT JOIN tutor_overall_level_subject AS tosl ON tosl.subject_level_id = tsl.subject_level_id AND tosl.tutor_id = '{$tutor_id}' ORDER BY tl.level_id, ts.subject_name"; $sql = mysqli_query($dbc, $query) or die(mysqli_error($dbc)); $query1 = "SELECT tl.level_id, tl.level_name, IF(tslvl.tutor_id='{$tutor_id}', 1, 0) as checked FROM tutor_level AS tl LEFT JOIN tutor_selected_level AS tslvl ON tslvl.level_id = tl.level_id AND tslvl.tutor_id='{$tutor_id}' ORDER BY tl.level_id, tl.level_name"; $sql1 = mysqli_query($dbc, $query1) or die(mysqli_error($dbc));
  10. Hi ansharma, This is my function () function createLevelCheckboxes($subjectArray, $levelArray, $columns) { if(count($levelArray)==0) { return false; } $htmlOutput = ''; //Display level header row $levelID = $levelArray[0]['level_id']; $levelName = $levelArray[0]['level_name']; foreach($levelArray as $data1) { //Display level header row $levelID = $levelArray[0]['level_id']; $levelName = $levelArray[0]['level_name']; $checked = ($data1['checked'] == 1) ? ' checked="checked"' : ''; $htmlOutput .= "<tr>\n"; $htmlOutput .= "<th colspan=\"{$columns}\" style=\"text-align:left;padding-top:15px;\">"; $htmlOutput .= "<input name=\"level[]\" type=\"checkbox\" id=\"level_{$levelID}\" type=\"checkbox\" {$checked} value=\"{$levelID}\">"; $htmlOutput .= "<span class=\"zone_text_enlarge\"><label for=\"level_{$levelID}\">{$levelName}</label></span>"; $htmlOutput .= "</th>\n"; $htmlOutput .= "</tr>\n"; } //Display each subject $recordCount = 0; foreach($subjectArray as $data) { //Increment counter $recordCount++; //Start new row if needed, 1/5 = R1 --> So create a new row if ($recordCount % $columns == 1) { $htmlOutput .= "<tr>\n"; } //Display the record $subjectID = $data['subject_level_id']; $subjectName = $data['subject_name']; $checked = ($data['checked'] == 1) ? ' checked="checked"' : ''; $htmlOutput .= " <td>\n"; $htmlOutput .= " <input name=\"subject_level[]\" class=\"subject_a\" type=\"checkbox\" {$checked}"; $htmlOutput .= " id=\"subject_level_{$subjectID}\" value=\"{$subjectID}\"/>\n"; $htmlOutput .= " <label for=\"subject_level_{$subjectID}\" class=\"subject_1\">{$subjectName}</label>\n"; $htmlOutput .= "</td>\n"; //Close row if needed, 5/5 = 0 --> So close the row if ($recordCount % $columns == 0) { $htmlOutput .= "</tr>\n"; } } //Close last row if needed if ($recordCount % $columns != 0) { $htmlOutput .= "</tr>\n"; } return $htmlOutput; }
  11. Hi harristweed, It's even worse after applying outside the loop. It is showing everything Initially it was... Level 1 Sci Level2 Sci Level3 Sci Now it is... Level 1 Math, Eng, Sci Level2 Math, Eng, Sci Level3 Math, Eng, Sci Correct example should be Level 1 Math Level 2 Eng Level 3 Sci And I realised you can't remove the $subject_data = array();, as it helps to store the correct value (math) into the correct level (level1) Any other advice? Can someone please enlighten me! Thank you
  12. Hi all, I am desperately in need of some help here. I have been troubleshooting these codes for days, and I have posted this similar question quite a couple of times, and there is no answer from anyone... I am really in a bad shape now. Could someone please enlighten me to my problem? I have created 2 while loops...apparently the 2nd while loop overwrites the 1st while loop record. Meaning to say...1st while loop generates values of 'Math' 'Eng' 'Chi' 'Sci' AND store it in $subject_data, createLevelCheckboxes($subject_data, $level_data, 5); Apparently, the 2nd while loop takes only the last record 'Sci' from $subject_data and continues the looping. Which gives me results like Level 1 Sci Level2 Sci Level3 Sci I would like to attain something like.... Level 1 Math Level2 Eng Level3 Chi Level4 Sci Is there any reset which I need to do? while($data = mysqli_fetch_array($sql)) { if($current_level_id != $data['level_id']) { $checkboxes .= createLevelCheckboxes($subject_data, $level_data, 5); $current_level_id = $data['level_id']; $subject_data = array(); } //Add the current record to the $level_data array $subject_data[] = $data; } while($data1 = mysqli_fetch_array($sql1)) //Iterate throug the DB results { $checkboxes .= createLevelCheckboxes($subject_data, $level_data, 5); $level_data = array(); $level_data[] = $data1; } $checkboxes .= createLevelCheckboxes($subject_data, $level_data, 5);
  13. Hi mjdamato, Thanks for the detailed codes. However, if the user checks on Pre-School, it should not check all the subejcts in Pre-School. Pre-School checkbox will only be checked, and when it's checked, it doesnt affect the subjects under its level. Perhaps, that is the reason why I have arranged an additional table called 'tutor_selected_level' to faciliate this logic. Do you know how I should work it in your given codes? I am still currently figuring what your codes are...Thanks
  14. Hi, Could anyone give me some advice? As I am running out of time to submit this portion for my project...Thank you!
  15. Hi all, I need some help here. Currently I am using 2 functions. 1) To call out the 'academic levels' 2) To call out the 'subjects' which matches to the specific 'academic level' However, I am stucked in the codes. Please view my picture attachment, my question is, how do I assigned 'red box (Pre-School)' to 'red box (subjects)' and so on...What are the codes or tweaks that I should make so that it will look like 'what do I want to achieve.jpg' My process and execution $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) or die(mysqli_error($dbc)); //Run query $tutor_id = mysqli_real_escape_string($dbc, $_GET['tutor_id']); $query = "SELECT tl.level_id, tl.level_name, ts.subject_id, ts.subject_name, tsl.subject_level_id, IF(tosl.tutor_id='{$tutor_id}', 1, 0) as checked FROM tutor_level AS tl INNER JOIN tutor_subject_level AS tsl USING (level_id) INNER JOIN tutor_subject AS ts USING (subject_id) LEFT JOIN tutor_overall_level_subject AS tosl ON tosl.subject_level_id = tsl.subject_level_id AND tosl.tutor_id = '{$tutor_id}' ORDER BY tl.level_id, ts.subject_name"; $sql = mysqli_query($dbc, $query) or die(mysqli_error($dbc)); $query1 = "SELECT tl.level_id, tl.level_name, IF(tslvl.tutor_id='{$tutor_id}', 1, 0) as checked FROM tutor_level AS tl LEFT JOIN tutor_selected_level AS tslvl ON tslvl.level_id = tl.level_id AND tslvl.tutor_id='{$tutor_id}' ORDER BY tl.level_id, tl.level_name"; $sql1 = mysqli_query($dbc, $query1) or die(mysqli_error($dbc)); //Process the results $checkboxes = ''; //Create variable for output $current_level_id = false; //Flag to check when records change level while($data = mysqli_fetch_array($sql)) //Iterate throug the DB results { if($current_level_id != $data['level_id']) //Determine if this level is different from the last { print_r ($data); $subjectCheckboxes .= createSubjectCheckboxes($subject_data, 5); $current_level_id = $data['level_id']; $subject_data = array(); } //Add the current record to the $level_data array $subject_data[] = $data; } //$checkboxes .= createLevelCheckboxes($subject_data, $level_data, 5); while($data1 = mysqli_fetch_array($sql1)) { print_r ($data1); $levelCheckboxes .= createLevelCheckboxes($level_data, 5); $level_data = array(); $level_data[] = $data1; } //Call the createLevelCheckboxes() function to generate the HTML for the LAST level records $levelCheckboxes .= createLevelCheckboxes($level_data, 5); $subjectCheckboxes .= createSubjectCheckboxes($subject_data, 5); My functions function createLevelCheckboxes($levelArray, $columns) { if(count($levelArray)==0) { return false; } $htmlOutput = ''; foreach($levelArray as $data1) { //Display level header row $levelID = $levelArray[0]['level_id']; $levelName = $levelArray[0]['level_name']; $checked = ($data1['checked'] == 1) ? ' checked="checked"' : ''; $htmlOutput .= "<tr>\n"; $htmlOutput .= "<th colspan=\"{$columns}\" style=\"text-align:left;padding-top:15px;\">"; $htmlOutput .= "<input name=\"level[]\" type=\"checkbox\" id=\"level_{$levelID}\" type=\"checkbox\" {$checked} value=\"{$levelID}\">"; $htmlOutput .= "<span class=\"zone_text_enlarge\"><label for=\"level_{$levelID}\">{$levelName}</label></span>"; $htmlOutput .= "</th>\n"; $htmlOutput .= "</tr>\n"; } return $htmlOutput; } function createSubjectCheckboxes($subjectArray, $columns) { //Display each subject $recordCount = 0; foreach($subjectArray as $data) { //Increment counter $recordCount++; //Start new row if needed, 1/5 = R1 --> So create a new row if ($recordCount % $columns == 1) { $htmlOutput .= "<tr>\n"; } //Display the record $subjectID = $data['subject_level_id']; $subjectName = $data['subject_name']; $checked = ($data['checked'] == 1) ? ' checked="checked"' : ''; $htmlOutput .= " <td>\n"; $htmlOutput .= " <input name=\"subject_level[]\" class=\"subject_a\" type=\"checkbox\" {$checked}"; $htmlOutput .= " id=\"subject_level_{$subjectID}\" value=\"{$subjectID}\"/>\n"; $htmlOutput .= " <label for=\"subject_level_{$subjectID}\" class=\"subject_1\">{$subjectName}</label>\n"; $htmlOutput .= "</td>\n"; //Close row if needed, 5/5 = 0 --> So close the row if ($recordCount % $columns == 0) { $htmlOutput .= "</tr>\n"; } } //Close last row if needed if ($recordCount % $columns != 0) { $htmlOutput .= "</tr>\n"; } return $htmlOutput; } [attachment deleted by admin]
×
×
  • 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.