Jump to content

srijon

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

srijon's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I am trying to fetch data from my database and when I display it I want to show serial numbers (Just like a list) , example: Serial Number Name Country 1. John USA 2. Srijon UK I have tried something with PHP Loops, but I couldn't make it work. Would you please kindly help me? please note that by serial numbers I don't mean values retrieved from database. Thanks in Advance Here's my Model //Function To Create All Batch List function batch_list($perPage,$uri) { $this->db->select('*'); $this->db->from('batch'); $this->db->join('teacher', 'batch.batchinstructor = teacher.teacherid'); $this->db->order_by('batchid','DESC'); $getData = $this->db->get('', $perPage, $uri); if($getData->num_rows() > 0) return $getData->result_array(); else return null; } //End of Function To Create All Batch List Here's my Controller function index(){ $this->load->library('pagination'); $config['base_url'] = base_url().'batchlist/index'; $config['total_rows'] = $this->db->get('batch')->num_rows(); $config['per_page'] = 20; $config['num_links'] = 20; $config['full_tag_open'] = '<div class="pagination" align="center">'; $config['full_tag_close'] = '</div>'; $this->pagination->initialize($config); $this->load->model('mod_batchlist'); $data['records']= $this->mod_batchlist->batch_list($config['per_page'] ,$this->uri->segment(3)); $data['main_content']='view_batchlist'; $this->load->view('includes/template',$data); } Here's my View <?php if(count($records) > 0) { ?> <table id="table1" class="gtable sortable"> <thead> <tr> <th>Batch Name</th> <th>Class</th> <th>Batch Instructor</th> <th>Edit/Delete</th> </tr> </thead> <tbody> <?php foreach ($records as $row){ ?> <tr> <td><a href="<?php echo base_url(); ?>batch/<?php echo $row['batchid']; ?>"><?php echo $row['batchname'];?></a></td> <td><?php echo $row['class'];?></td> <td><?php echo $row['teachername'];?></td> <td> <a href="<?php echo base_url(); ?>updatebatch/get/<?php echo $row['batchid']; ?>" title="Edit"><img src="<?php echo base_url(); ?> support/images/icons/edit.png" alt="Edit" /></a> <a href="#" title="Delete"><img src="<?php echo base_url(); ?>support/images/icons/cross.png" alt="Delete" /></a> </td> </tr> <?php } ?> </tbody> </table> <?php } ?> <div class="tablefooter clearfix"> <div class="pagination"> <?php echo $this->pagination->create_links(); ?> </div> </div>
  2. Thanks for you reply. But I don't want to enable it, all I am looking for is what to use instead of this-" $number = $_GET['studentid']; " Please kindly check the code I submitted again. Thanks
  3. I have a page called list.php which retrieves from database and shows all the student names with their respective ids in a list. In raw php, this is how I have done this- include("connect.php"); $query = "SELECT * FROM marks "; $result = mysql_query($query); $num = mysql_num_rows ($result); mysql_close(); if ($num > 0 ) { $i=0; while ($i < $num) { $studentname = mysql_result($result,$i,"studentname"); $studentid = mysql_result($result,$i,"studentid"); ?> And then--- <a href="studentprofile.php?studentid=<? echo $studentid?>"><? echo $studentname ?></a> <? ++$i; } } else { echo "No Record Found"; } ?> When a user clicks on any of the student names, it takes the user to the page of that particular student and in that page I have a code like following- include("connect.php"); $number = $_GET['studentid']; $qP = "SELECT * FROM student WHERE studentid = '$number' "; $rsP = mysql_query($qP); $row = mysql_fetch_array($rsP); extract($row); $studentid = trim($studentid); $studentname = trim($studentname); $studentgender = trim($studentgender); The above code is working just fine. Now as far as I know $_get is disable in Codeigniter. But how to do the exact same thing that I mentioned above in codeigniter if $_get is disabled ? I went through some tutorials on alternative way of using $_get, but I didn't understand those well. Would you please kindly help? Thanks in Advance codeigniter
  4. @Sunfighter.. At first many thanks for your reply. Actually since I have no idea about how many students will exactly be enrolled for a particular class, I don’t know how many obtainedmark1..2..3.. I should use. So i think passing the value to the JS function would be a good idea, but I am not sure how to do this. Would you please kindly brief me on how to do this? Thanks again for your help.
  5. Hi, I am trying to create a page where teachers will be able to input marks. So far what I have managed to develop is like this- the page shows the list of students with their names and roll numbers in the first and second column. In the third column, there is a text box to input the obtained marks and once it is filled and the user moves to the next textbox, I intend it to automatically calculate the grades and GPAs and show in the four and five column in two text boxes and here I am stuck now. To automatically calculate GPA I have coded a javascript function, but the problem is it shows GPA and Grade only for the student who is on the very top of the list. It doesn’t work for rest of the students or you can say textboxes. Would you please kindly help me to solve this problem? I have snapshot of the problem. here is the link - http://oi56.tinypic.com/2622vpf.jpg and i have attached it with this message also. Thanks in Advance Here is the code that I have developed so far- <html> <head> </head> <body> <form name="form" action="ball.php" method="post"> Total Mark <input size="5" id="totalmark" type="text" name="totalmark" value=""/> <table align="center" border="0" width="70%"> <tr class="table_head"> <td width="37%"><div align="center"><strong><span class="style3">Student Name </span></strong></div></td> <td width="22%"><div align="center"><strong><span class="style3">Student ID </span></strong></div></td> <td width="21%"><div align="center"><strong><span class="style3">Obtained Mark</span></strong></div></td> <td width="20%"><div align="center"><strong><span class="style3">Grade</span></strong></div></td> <td width="20%"><div align="center"><strong><span class="style3">GPA</span></strong></div></td> <td width="20%"><div align="center"><strong><span class="style3">Status</span></strong></div></td> </tr> <?PHP include("connect.php"); $query = "SELECT * FROM student WHERE batch= 'Eight-A' "; $result = mysql_query($query); $num = mysql_num_rows ($result); mysql_close(); if ($num > 0 ) { $i=0; while ($i < $num) { $studentname = mysql_result($result,$i,"studentname"); $studentid = mysql_result($result,$i,"studentid"); ?> <tr style="background:<?=(($i%2)?'#ddd':'#eee')?>"> <td><div align="center"><span class="style3"><a href="studentprofile.php?studentid=<? echo $studentid?>"><? echo $studentname ?></a></span></div></td> <td><div align="center"><span class="style3"><input type="hidden" name="studentid[]" value="<? echo $studentid?>"><? echo $studentid?> </span></div></td> <td><div align="center"><span class="style3"><input id="obtainedmark[]" onBlur="recalculateSum();" size="5" type="text" name="obtainedmark[]" value=""/></span></div></td> <td><div align="center"><span class="style3"><input id="grade" size="5" type="text" name="grade" value=""/></span></div></td> <td><div align="center"><span class="style3"><input id="gradepoint" size="5" type="text" name="gradepoint" value=""/></span></div></td> <? include('pullgradesinfo.php'); ?> <script language="javascript"> function recalculateSum() { var num1 = parseFloat(document.getElementById("obtainedmark").value); var num2 = parseFloat(document.getElementById("totalmark").value); if (num1 > num2) { alert('The obtained mark suppose to be lesser than the Total Mark'); return false; } else { var num3= ((num1/ num2)*100).toFixed( 1 ) ; if (num3 >="<?= $mark1?>" ) {var gradepoint= "<?=$gradepoint1?>"; var grade="<?=$grade1?>";} if (num3 ==100 ) {var gradepoint= "<?=$gradepoint1?>"; var grade="<?=$grade1?>";} if (num3 >="<?= $mark2?>" && num3 < "<?=$mark1?>" ) {var gradepoint="<?=$gradepoint2?>"; var grade="<?=$grade2?>";} if (num3 >="<?= $mark3?>" && num3 < "<?=$mark2?>" ) {var gradepoint="<?=$gradepoint3?>"; var grade="<?=$grade3?>";} if (num3 >="<?= $mark4?>" && num3 <"<?= $mark3?>" ) {var gradepoint="<?=$gradepoint4?>"; var grade="<?=$grade4?>";} if (num3 >="<?= $mark5?>" && num3 < "<?=$mark4?>" ) {var gradepoint="<?=$gradepoint5?>"; var grade="<?=$grade5?>";} if (num3 >="<?= $mark6?>" && num3 <"<?= $mark5?>" ) {var gradepoint="<?= $gradepoint6?>"; var grade="<?=$grade6?>";} if (num3 >="<?= $mark7?>" && num3 <"<?= $mark6?>" ) {var gradepoint="<?=$gradepoint7?>"; var grade="<?=$grade7?>";} if (<?= $mark7?> > num3 ) {var gradepoint="<?=$gradepoint7?>"; var grade="<?=$grade7?>";} document.getElementById("grade").value = (grade); document.getElementById("gradepoint").value = (gradepoint); } } </script> <td><div align="center"><span class="style3"><select name="status[]"> <option value="Present">Present </option> <option value="Absent">Absent </option></select></span></div></td> </tr> <a href="in.ph" > </a> <? ++$i; } } else { echo "No Record Found"; } ?> <tr> <td><input type="submit" value="Submit" name="Submit"> </td></tr> </table> <input type="hidden" name="highestmark" value="20"/> <input type="hidden" name="subject" value="Bangla 1"/> <input type="hidden" name="examdate" value="2011-01-01"/> <input type="hidden" name="examtype" value="Mid Term"/> <input type="hidden" name="totalmark" value="20"/> </form> </body> </html> [attachment deleted by admin]
  6. I have written the following PHP script. It is working ok but I having problem with the AM and PM issue here. My script cannot differentiate AM and PM. Please help me.. Thanks in Advance <?php $d=("1:01 AM"); if ($d < "2:00 PM") echo "Present"; elseif ($d > "2:00") echo "Late"; elseif ($d == "2:00") echo "Equal"; else echo "Have a nice day!"; ?>
  7. Hi, I am new in PHP World, so please help me with the following problem. I have a HTML form which looks like the following..let’s say diagram. The DAY column is fixed, Sunday, Mondays..are just labels. I want my users to pick IN Time and OUT Time for different days and then select ON from dropdown list if they have picked any time, or otherwise select OFF. After submission I want these information to be saved in a table named "Attendance" and want to display the information later. Now would you please kindly tell me the PHP scripts for this and how would be the database table structure? Day In Time Out Time Status Sunday (fixed) 2:00 PM 4:05 PM ON Monday (fixed) -- -- OFF Tuesday (fixed) 2:00 PM 4:05 PM ON Wednesday (fixed) -- -- OFF Thursday (fixed) 2:00 PM 4:05 PM ON Friday (fixed) -- -- OFF Saturday (fixed) 2:00 PM 4:05 PM ON Thanks in Advance
×
×
  • 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.