Documentation

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
v2.0:modules:database [2011/12/14 23:26]
Franz
v2.0:modules:database [2011/12/14 23:37]
Franz
Line 71: Line 71:
 $params = array(':​yesterday'​ => time() - 24*60*60); $params = array(':​yesterday'​ => time() - 24*60*60);
  
-$result ​= $query->​run($params);​+$active_forums ​= $query->​run($params);​
 </​code>​ </​code>​
  
 === 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()); 
 + 
 +$num_inserted = $query->​run($params);​ 
 +</code>
  
 === UPDATE === === UPDATE ===
 +
 +FIXME //starting here...//
  
 === DELETE === === DELETE ===