+ +) {
echo $query 1[$row]->name."
}
?>
foreach ($query 1 as $v):?>
echo $v->name;? >
Endforeach;? >
echo $headline;?>
Description: You can use for and foreach multiple methods to find the data you want!Description: If the whole page is garbled , the page header is probably the case.SOURCE print?
Meta http-equiv= "content-type" content= "text/html; Charset=utf-8 " />
If you are not using CI
Example code of the redis Cache-related operation file in the CI framework, ciredis. Example code of the redis Cache-related operation file in the CI framework. ciredis this article describes the redis Cache-related operation files in the CI framework. For your reference, re
This is for beginners to see, this is the simplest can be adjusted to the example, many online examples of beginners in fact the local run, lack of this less.1. Download the CI framework (find it yourself)2. Configurationdatabase.php configuration:To set the connection parameter for the database server:$db [' Default '] [' hostname '] = "your-db-host"; $db [' Default '] [' username '] = ' your-username '; $
The example in this article describes the MVC simple example of getting started with the CI framework. Share to everyone for your reference, specific as follows:
The simplest CI model:
Note: The model needs to use a database
Configuration file in appcation/config.php
Here we want to use the database, need to databa
This is the simplest example for beginners to call. Many examples on the Internet are actually not available for beginners.
1. Download the CI framework (find it by yourself)
2. Configuration
Database. php Configuration:Set the connection parameter for the database server:
$db['default']['hostname'] = "your-db-host";$db['default']['username'] = "your-username";$db['default']['password'] = "your-password";$
This example describes the CI framework file upload class and image processing class usage. Share to everyone for your reference, specific as follows:
List page banner picture public function Edit_list_page_banner ($category _id= "") {$category _id= empty ($category _id)? $_post["
category_id "]: $category _id; Upload picture if (isset ($_post["key")) $_post["key"] = = "Upload") {/* 1.set_upload_pa
() {parent::__construct (); Load the data Model $this->load->model (' Nb_model '); } Public Function Index () { ///Data Model $data[' NB ']= $this->nb_model->get ();//Load View file $this->load-> View (' NB ', $data);}} End of File comment/* end of File nb.php *//* location:./application/controllers/nb.php */3. Finally talk about "V"With the database model and its methods, we should be extracting the data.Controllers in CI
Nction __construct () {parent::__construct (); Load Data Model $this->load->model (' Nb_model '); } Public Function Index () { ////Data Model $data[' NB ']= $this->nb_model->get ();//Load View file $this->load-> View (' NB ', $data);}} File End Gaze/* End of File nb.php *//* location:./application/controllers/nb.php */3. Finally talk about "V"the database model and its methods are available. Then we should be extracting the data.Controllers in
determine the page number of pages.
For example LOCALHOST/NEWS/PAGE/3 this uri_segment will be set to 3. Localhost/news/title/page/3 This is going to be set to 4.
*/
$config [' use_page_numbers '] = TRUE;
/* This is the difference between a, b). is turned on, page will indicate the number of pages. False will indicate the number of records
*/
When I first started to look up information on the Internet, there were many of these.
Cop
;result_array (); Return Array (' total ' = $total, ' data ' = $data); }
CI Framework page-like use of the experience
There are four ways to address the URL of CI pagingA) LOCAHOST/NEWS/PAGE/2 This 2 represents the second pageb) Localhost/news/page/20 This 20 means that starting with the 20th record, paging, the first record of the page, is the 20th record in the database.c) localhost/news?per_page=2 se
Hello, Everyone! I haven't seen you in some days. Fortunately, the end-of-the-world predictions of the Mayans are not true. you can also let the big guys continue to listen to their military elders ~~~ Hello, Everyone! I haven't seen you in some days. Fortunately, the end-of-the-world predictions of the Mayans are not true. you can also let the big guys continue to listen to their military elders ~~~
Today we are going to learn the controllers, methods, and views in the
This example describes the Redis cache-related operations file in the CI framework. Share to everyone for your reference, specific as follows:
Redis Cache class File location:
' Ci\system\libraries\cache\drivers\cache_redis.php '
More interested in CodeIgniter related content readers can view the site topics: "CodeIgniter Introductory Course", "
Example code of redis cache-related operation file in the CI framework, ciredis
This article describes the redis cache-related operation files in the CI framework. We will share this with you for your reference. The details are as follows:
Redis cache file location:
'Ci \ system \ libraries \ Cache \ drivers \ Cache_re
the corresponding incremental deletion statement OK
//Clear All cache
$this->db->cache_delete_all ()/
*
empty A single cached
example.com/index.php/blog/comments page, the caching system puts all the generated cache files into
a folder named Blog+comments. If you want to remove the cached file corresponding to the example mentioned earlier, you
need to execute the following code:
* *
$this->db->cache_delete ('/blog ', ' comments ');
More inter
Example of inserting one or more SQL records in the php CI framework
This section describes how to insert one or more SQL records in the php CI framework. The sample code is as follows. Do not miss it if you are not familiar with it.
1. Insert a record
$ Data = array (
'Title' => 'my title ',
'Name' => 'my name ',
'Date' => 'my date'
);
$ This-> db-> inse
An example of this article describes the automatic loading of classes in CI frames. Share to everyone for your reference, specific as follows:
Application/config
Add in configuration file:
| 1. Packages| 2. Libraries| 3. Helper files| 4. Custom Config files| 5. Language files| 6. Models
1. Third party library file loading
$autoload [' packages '] = Array (apppath. ' Third_party ', '/usr/local/sh
Example of using CI to operate multiple databases
Function _ construct ()
{
Parent: :__ construct ();
$ This-> xx = $ this-> load-> database ('XX', TRUE );
$ This-> load-> model ('default database and table name ');
}
Function index ()
{
// You can use $ this-> xx-> query () to execute the SQL statement of the X
Join usage in mysqlInternal connection1. Concept: inner join is a join that uses a comparison operator to compare the values of the columns to be joined.2. inner join: join or inner join3. SQL statementsSelect * from table1 join table2 on table1.id = table2.id------------- Result -------------Idnameidscore------------------------------1lee1902zhang2100------------------------------Note: Only the table1 and table2 columns that meet the conditions are returned.4. Equivalent (same as the following
Download: Self-Baidu.Page code:Configuration file Modification:Here I put the Ueditor plug-in: the public/js/ueditor directory;Configuration file path:public/js/ueditor/php/config.jsonTo modify the upload path:Write here first,,, to be continued ...Use of Ueditor (Php+ci for example)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.