Documentation

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
v2.0:modules:database [2011/12/14 23:26]
Franz
v2.0:modules:database [2011/12/14 23:36]
Franz [CRUD queries]
Line 76: Line 76:
 === INSERT === === INSERT ===
  
-FIXME //starting here...//+INSERT queries allow for creating rows in tables. 
 + 
 +== Fields == 
 + 
 +^ Name ^ Example ^ Description ^ 
 +| ''​values'' ​ | <​php>​array('​id'​ => 1, '​name'​ => '​Test'​)<​/php> ​ | An array of values to be stored in the database tableThe key of each element should be the name of the corresponding column | 
 + 
 +== Return value == 
 + 
 +The number of rows that were inserted. 
 + 
 +== Example == 
 +<​code=php>​ 
 +$query = $db->​insert(array('​username'​ => '​test',​ '​registered'​ => ':​now'​),​ '​users'​);​ 
 +$params = array(':​now'​ => time()); 
 + 
 +$result = $query->​run($params);​ 
 +</code>
  
 === UPDATE === === UPDATE ===
 +
 +FIXME //starting here...//
  
 === DELETE === === DELETE ===