Very New to Codeigniter need help - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Very New to Codeigniter need help (/showthread.php?tid=66564) Pages:
1
2
|
Very New to Codeigniter need help - Jay01 - 11-04-2016 I have to join 4 tables using the SQL Select Statement I do not know how to set it up in Model , controllers/admin.php, application\models\Crud_model.php, application\controllers\Admin.php and the application\views\backend\admin\view.php to display my output or print it with pdf This is my Coding I hope someone out there can give me a heads up on this Thanks and God Bless CODINGS Code: <?php RE: Very New to Codeigniter need help - skunkbad - 11-04-2016 Are you asking where to put the code, how to create a PDF, or something else? RE: Very New to Codeigniter need help - Jay01 - 11-05-2016 (11-04-2016, 11:28 PM)skunkbad Wrote: Are you asking where to put the code, how to create a PDF, or something else? I am asking for help on where to put the code, and how to even view the code or print in PDF . One thing I read about codeigniter is that one has to put some codes in the Crude model and some codes in controller to reference it before writing a code to view it in pdf document Thanks so much if you can give me an heads up to make this code run and show output Once I see an example I will be able to write more query in SQL without any help God Bless Jay01 RE: Very New to Codeigniter need help - InsiteFX - 11-05-2016 PDF generate in Codeigniter using DOMPDF RE: Very New to Codeigniter need help - Jay01 - 11-05-2016 (11-05-2016, 04:51 AM)InsiteFX Wrote: PDF generate in Codeigniter using DOMPDFInsiteFX, It was nice reading from you. This problem is just to create a List of Debtors I have Four Tables Namely Invoice, Student, Parent and Class Section I.E Section. This is what I think might be the solution but nothing is being created since I am new to coding with codeigniter I have to join 4 tables using the SQL Select Statement I do not know how to set it up in Model , controllers/admin.php, application\models\Crud_model.php, application\controllers\Admin.php and the application\views\backend\admin\view.php to display my output or print it with pdf <?php function get_debtors( ) { $this->db->select('invoice.student_id as STUDENT_ID,student.name AS STUDENT_NAME,section.name AS CLASS,invoice.description AS DESCRIPTION, invoice.amount AS TOTAL_AMOUNT, invoice.amount_owed AS AMOUNT_OWED, parent.name AS PARENT_NAME, parent.email AS PARENT_EMAIL, parent.phone AS PARENT_PHONE, parent.address AS PARENT_ADDRESS, invoice.status AS STATUS'); $this->db->from('invoice , student , parent , section '); $this->db->join('student ', 'student.student_id = invoice.student_id'); $this->db->join('parent ', 'parent.parent_id = student.parent_id, 'left''); $this->db->join('section ', 'section.section_id = student.section_id','left'); $this->db->where('invoice.status', 'debtor'); $query = $this->db->get(); <div id="print"> <script src="assets/js/jquery-1.11.0.min.js"></script> <style type="text/css"> td { padding: 5px; } </style> <center> $system_name = $this->db->get_where('settings' , array('type'=>'system_name'))->row()->description; <img src="uploads/logo.png" style="max-height : 60px;"><br> <h3 style="font-weight: 100;"><?php echo $system_name;?></h3> <?php echo get_phrase('Debtor List');?><br> </center> <?php foreach ($query->result() as $row) { $i = 0; $max = 25; if ($i == $max) or ($i == 0) { //print column titles for the current page </center> <table style="width:100%; border-collapse:collapse;border: 1px solid #ccc; margin-top: 10px;" border="1"> <tbody> <thead> <tr> <td style="text-align: center;">STUDENT ID</td> <td style="text-align: center;">STUDENT NAME</td> <td style="text-align: center;">CLASS</td> <td style="text-align: center;">DESCRIPTION</td> <td style="text-align: center;">TOTAL AMOUNT</td> <td style="text-align: center;">AMOUNT OWED</td> <td style="text-align: center;">PARENT NAME</td> <td style="text-align: center;">PARENT EMAIL</td> <td style="text-align: center;">PARENT PHONE</td> <td style="text-align: center;">PAREBT ADDRESS</td> <td style="text-align: center;">STATUS</td> </tr> </thead> //Set $i variable to 0 (first row) $i = 0; } $i += 1; <tr> echo '<td><div align="left">'.$row['STUDENT_ID'].'</td>'; echo '<td><div align="left">'.$row['STUDENT_NAME'].'</td>'; echo '<td><div align="left">'.$row['CLASS'].'</td>'; echo '<td><div align="left">'.$row['DESCRPTION'].'</td>'; echo '<td><div align="left">'.$row['TOTAL_AMOUNT'].'</td>'; echo '<td><div align="left">'.$row['AMOUNT_OWED'].'</td>'; echo '<td><div align="left">'.$row['PARENT_NAME'].'</td>'; echo '<td><div align="left">'.$row['PAREBT_PHONE'].'</td>'; echo '<td><div align="left">'.$row['PARENT_ADDRESS'].'</td>'; echo '<td><div align="left">'.$row['STATUS'].'</td>'; } <?php endforeach; ?> ?> </tbody> </table> <br> <center> </center> </div> ?> This code above is not out putting anything that means I have not done the right thing that conforms with codeigniter. RE: Very New to Codeigniter need help - InsiteFX - 11-05-2016 I think you need to read the CodeIgniter Users Guide to know what you are doing here. RE: Very New to Codeigniter need help - Jay01 - 11-05-2016 (11-05-2016, 10:33 AM)InsiteFX Wrote: I think you need to read the CodeIgniter Users Guide to know what you are doing here. I am expecting an output it is not bringing anything it is not even detecting that php file. I have read through the Codeigniter tutorial it is furstrating RE: Very New to Codeigniter need help - Wouter60 - 11-05-2016 First, learn the basics of CodeIgniter. Controllers are for processing URL's. E.g. the url www.mysite.com/invoices/debts will call the debts function in the Invoices controller. Models are for database actions, like getting records from a table. A function in an model will return a record or an array of records to the controller. Views are for output. They consist of html-code, mixed with php. The php variables are passed by the controller to the view. In short, controllers are the heart of your application. They collect data from a model or library, and they pass data to a view that will show you the end result in the browser. To make life easier for us, please put your php code in a php code block. You will find a button for that at the top of the text editor field where you type your forum message. You should always make clear what type of file your code is in (controller, model, library, view, config file etc.). RE: Very New to Codeigniter need help - Jay01 - 11-05-2016 (11-05-2016, 12:35 PM)Wouter60 Wrote: First, learn the basics of CodeIgniter. Thanks and God Bless I will re work my codes and get back with U after using this methodology RE: Very New to Codeigniter need help - Jay01 - 11-05-2016 (11-05-2016, 12:35 PM)Wouter60 Wrote: First, learn the basics of CodeIgniter. |