[Newbie] Need help to display results. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10) +--- Thread: [Newbie] Need help to display results. (/showthread.php?tid=75728) |
[Newbie] Need help to display results. - g4blin - 03-10-2020 Hi i am new in using codeigniter ihave this codes This is my model Code: function select_qnum_query(){ this is my controller Code: function select_qnum(){ and this is my view Code: <script src ="<?php echo base_url("assets/js/jquery-3.4.1.min.js"); ?>"></script> RE: [Newbie] Need help to display results. - tweenietomatoes - 03-10-2020 PHP Code: <?php echo base_url() ?> missing ; so make it base_url(); or use PHP Code: <?=base_url()?> RE: [Newbie] Need help to display results. - zahhar - 03-10-2020 Your model uses result() that does not exis on $query object. You should use getResult() instead. I also simplified your code a bit: PHP Code: function select_qnum_query() You could also benefit from AP Response Trait in your controller to get rid of echo, https://codeigniter4.github.io/userguide/outgoing/api_responses.html RE: [Newbie] Need help to display results. - tweenietomatoes - 03-10-2020 return $qb->select('qnum')->where("transaction", "landtax")->get()->getResult(); RE: [Newbie] Need help to display results. - jvandemerwe - 03-11-2020 Code: <script> Are you sure that you should not have a ready in your JavaScript? Code: $(document).ready(function () { You could put a var_dump('<pre>', $queryResult, '</pre>') in your model to see if you have any records. Even when using Ajax the browser will show the result for test. RE: [Newbie] Need help to display results. - g4blin - 03-11-2020 (03-10-2020, 03:40 PM)zahhar Wrote: Your model uses result() that does not exis on $query object. Still it doesn't run. Does it need ->from('tblkiosk')? I tried to put it but still no result. :( RE: [Newbie] Need help to display results. - g4blin - 03-12-2020 (03-11-2020, 10:23 AM)jvandemerwe Wrote:Still no result. RE: [Newbie] Need help to display results. - InsiteFX - 03-12-2020 Where are your <head> and <body> tags your JavaScript should go just above your </body></html> unless it is called first in your html then the scripts need to be in the <head></head> tags. How does jQuery know which button is being clicked? Code: <button id="btnSubmit">Payment</button> |