codeigniter

selecting all orders for last 30 days, and counting how many per day

我的梦境 提交于 2020-01-02 05:34:09
问题 I am trying to select all orders for last 30 days from one customer, so I need to have customer_id = "$customer_id" and count how many orders I have per each day for that one customer. I need to end up with array like this Array ( [1] => Array ( [orders] => 41 [date] => 2011-06-13 17:43:50 ) [2] => Array ( [orders] => 11 [date] => 2011-07-13 17:43:50 ) [4] => Array ( [orders] => 2 [date] => 2011-12-13 17:43:50 ) and so on... for 30 days, if some day I dont have any orders, I dont need array

How to query a database from view - CodeIgniter

廉价感情. 提交于 2020-01-02 05:31:09
问题 I have query that runs in the controller: $data['query'] = $this->Member->select_sql($id); $this->load->view('myform'); and then outputs data in the view: foreach ($query->result() as $row): echo $row->post_title; echo $row->post_user_id; endforeach; So this outputs me a list of posts made by a user. Now I would like to run one more query that would for each post loop through my user table and output user information next to each post. (I dont want to select data from a view or joint those 2

Datatables joining tables search and order stuck with codeigniter

好久不见. 提交于 2020-01-02 05:04:28
问题 I was follow this step to learn datatables with codeigniter. But I'm getting some error with joining two tables to use search at datatables. This is my error, And then as I see at the documentation AJAX error, the resolution is search finding error server at network request browser. And I'm getting 500 Internal Server Error. This is I copied the response body for the fault. Error Number: 42000/1064 You have an error in your SQL syntax; check the manual that corresponds to >your MySQL server

Undefined variable in CodeIgniter View

耗尽温柔 提交于 2020-01-02 03:53:25
问题 I'm trying to print my key/value pairs of data in my CodeIgniter view. However, I'm getting the following error. What I'm I doing wrong? A PHP Error was encountered Severity: Notice Message: Undefined variable: data Filename: views/search_page2.php Line Number: 8 application/controller/search.php // ... $this->load->library('/twitter/TwitterAPIExchange', $settings); $url = 'https://api.twitter.com/1.1/followers/ids.json'; $getfield = '?username=johndoe'; $requestMethod = 'GET'; $twitter = new

Pagination current link not highlighting

妖精的绣舞 提交于 2020-01-02 03:02:23
问题 I got a strange problem, my current pagination link is not highlighted the pagination urls I made looks like: site.com/list/50/?some=value Everything is working great, but the current pagination link in view is not highlighted. I checked CSS and it's ok, the problem comes from the library I guess. This is my code. I can't see anything wrong in here: $pagination['base_url'] = site_url('asd'); if($_SERVER['QUERY_STRING'] !==''){ $pagination['suffix'] = '/?'.$_SERVER['QUERY_STRING']; }

CodeIgniter Active Record vs. regular queries

99封情书 提交于 2020-01-02 02:33:07
问题 Currently I use CodeIgniter with regular queries, i.e.: $sql = " SELECT * FROM my_table WHERE item_id > 1 "; $q = $this->db->query($sql); I have started looking into ActiveRecord, and it does look nice, and has the advantage of the query being built regardless of which database driver is used - however, I strictly use a single database type per project in general, so this is not really a benefit for me. I found that regular queries (as I have in my example) are more readable and easier

check old password and updating a new password using codeigniter

試著忘記壹切 提交于 2020-01-01 22:29:12
问题 Hi i have this page change password. I want to check the current password that matches into the database. then saving the new password on it. However i got it compared in the old password that checks on the database. Im wondering that when i click the change password button there is a pop up dialog box that says confirm password change, and i dont know where that pop up dialog came from. And also my saveNewPass code will not work. Can someone help me figured this out?. Here is my code below.

Passing multiple optional parameter/value pairs with user defined pair order

こ雲淡風輕ζ 提交于 2020-01-01 19:54:13
问题 Say user is going to search on 4 or 5 fields, ok? eg. he might want to search by firstname, email, mobile or even page number I want that codeigniter's url be like this: site.com/Controller/Method/variable1/value1/variable2/value2/variable3/value3 or site.com/Controller/Method/variable2/value2/variable3/value3/variable1/value1 (that they should have the same result) or in this format site.com/Controller/Method/variable2/value2/variable4/value4 some examples to clarify my question: site.com

PayPal discount can't make it work

依然范特西╮ 提交于 2020-01-01 19:33:11
问题 I'm trying to setup a discount for a the whole cart using PayPal + Codeigniter, I got this working withouth the discounts. As far as I've read the only thing that I would need to do is set a hidden field discount_amount_cart as I saw here Here is my form: <form method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr" name="paypal_form"> <input type="hidden" name="rm" value="2" /> <input type="hidden" name="cmd" value="_cart" /> <input type="hidden" name="upload" value="1" />

CodeIgniter is inserting twice the same entry. In some cases

我是研究僧i 提交于 2020-01-01 19:21:39
问题 I am trying to figure out why Codeigniter is inserting 2 times the same row in my Database. I'm using PDO as interface for mySQL. I was debugging it and I am sure the function bellow is not being executed two times. It happens in a particular case, if the two foreache's don't run because the array is empty, but if one of them runs the error doesn't happen. ` public function save_all() //save all information with the launched flag FALSE { include(database_vars_url()); try { $this->add_new