Quick links: Content - sections - sub sections
EN

Trace:

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
en:tutorial:database-config [2006/09/29 08:51] doublefaceen:tutorial:database-config [2006/11/08 11:05] – (old revision restored) 127.0.0.1
Line 4: Line 4:
  
 Jelix can handle mysql, postgresql, sqlite and pdo. Through its driver system, it is possible to add other types of databases (if you don't want to use pdo). Jelix can handle mysql, postgresql, sqlite and pdo. Through its driver system, it is possible to add other types of databases (if you don't want to use pdo).
 +
  
  
Line 44: Line 45:
 It is indeed sometimes interesting to have several entrance points, then several  settings sharing the same connexion profiles file, or that each one has its own connexions file. It is indeed sometimes interesting to have several entrance points, then several  settings sharing the same connexion profiles file, or that each one has its own connexions file.
  
 +
 +
 +===== Creation of the table =====
 +
 +In the "actu" base, we will now create a news table. Execute this sql script (adapt it if you are not using mysql):
 +
 +<code sql>
 +
 +CREATE TABLE `news` (
 +`id_news` INT NOT NULL AUTO_INCREMENT ,
 +`subject` VARCHAR( 255 ) NOT NULL ,
 +`text` TEXT NOT NULL ,
 +`news_date` DATE NOT NULL ,
 +PRIMARY KEY ( `id_news` )
 +);
 +</code>
 +
 +And feed this table avec deux news (we will make a form later).
 +
 +<code sql>
 +INSERT INTO `news` VALUES (1, 'first news', 'This is a first news. In commodo, neque sit amet laoreet accumsan, neque velit rutrum augue, a fringilla nibh lorem nec est. Cras eleifend eros. Sed vehicula. Donec vel enim at nunc tincidunt pellentesque. Donec malesuada. Praesent volutpat orci ut leo. Donec dictum tortor quis odio. Aliquam pulvinar justo eu eros.', '2006-01-15');
 +
 +INSERT INTO `news` VALUES (2, 'Lorem Ipsum', 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Suspendisse enim elit, luctus in, rhoncus quis, facilisis in, nulla. Nam eu dolor vel erat semper porta. Phasellus pellentesque nulla a urna. Phasellus nonummy diam id risus. Donec faucibus mi sed nisi. Sed et lectus at ligula scelerisque tempus. Proin justo nibh, consectetuer porta, accumsan ac, consectetuer id, dui. Morbi at mi auctor urna elementum convallis. Etiam et massa porta risus imperdiet ullamcorper. Aenean a metus at tortor ultrices accumsan. Mauris luctus.', '0000-00-00');
 +</code>
 +
 +We are now ready to use this data in our application.
 +
 +----
 +   * Next : [[en:tutorial:using-dao|Using a DAO]]
 +   * Previous : [[en:tutorial:creating-action|Creating an action action]]
 +   * [[en:tutorial|Back to the summary]]

en/tutorial/database-config.txt · Last modified: 2007/09/17 22:42 by 127.0.0.1

Recent changes RSS feed Creative Commons License