ionvur.blogg.se

Using codeigniter with rapid php
Using codeigniter with rapid php




using codeigniter with rapid php

In this article, we’ll look at the different methods for creating a website, and discuss how a framework can improve the process. For instance, the CodeIgniter PHP framework provides an elegant solution for web developers seeking a simple toolkit for getting the job done. This can help to make the development process easier, faster, and safer. One way to build a fully-featured website is to employ a framework. If you are looking to create a truly dynamic website, however, you may need to dig deeper into the web development world. A lot of people opt for the ease of use of a Content Management System (CMS), which can be an excellent option. This has a negative impact on execution time, but depending on your server's capacity is likely preferable to data corruption.There are many different ways to build a website. $this->db->query('LOCK TABLE (your table name) WRITE') Two successive inserts, and the return of a wrong ID will compromise the integrity of your data. It states the ID is from "the last query". If this function is a wrapper function for mysqli_insert_id, the documentation at php.net is unclarified. It concludes that the appropriate resolution is to take your chances.

using codeigniter with rapid php

If two inserts are done in rapid succession, how do you have confidence that the ID returned from insert_id is the proper ID?Ĭodeigniter documentation does not answer this questionĪ relevant blog entry from ellis lab does not resolve the question.

using codeigniter with rapid php

Your question exposes a potential bug in the codeigniter environment. I think the answer is 1, and that there's no problem, but I wanted to be sure. My question is: Out of the following, what does $this->db->insert_id() do:ġ) Does it get the ID that has just been inserted in (and only from) insert query just run?Ģ) Does it get the last inserted ID from the latest entry in the database regardless of what query its come from?īasically I'm trying to avoid orders being mixed up, say for example if several customers were submitting orders at the same time, I don't want one customer's order items to be added to the incorrect order. I'm using the following in several places around the site, mainly when a user is submitting an order: $this->db->insert_id() īasically when a user submits an order, it will add the order to one table, and then, within the same segment of code (immediately after the insert query), add each order item to another table using the ID created when the order is inserted into the first table.

using codeigniter with rapid php

I'm building an eCommerce site with Codeigniter which will allow users to register, buy products and then track the orders.






Using codeigniter with rapid php