-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from khaoulamerah/dev
Dev
- Loading branch information
Showing
36,960 changed files
with
4,024,440 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
require 'rb.php'; | ||
R::setup(); | ||
R::freeze( TRUE ); | ||
R::setup( 'mysql:host=localhost;dbname=mydatabase', | ||
'user', 'password' ); //for both mysql or mariaDB | ||
|
||
$opts = getopt( '', [ 'add:', 'list' ] ); | ||
if ( isset( $opts['add'] ) ) { | ||
$w = R::dispense( 'whisky' ); | ||
$w->name = $opts['add']; | ||
$id = R::store( $w ); | ||
die( "OK.\n" ); | ||
} | ||
if ( isset( $opts['list'] ) ) { | ||
$bottles = R::find( 'whisky' ); | ||
if ( !count( $bottles ) ) | ||
die( "The cellar is empty!\n" ); | ||
foreach( $bottles as $b ) { | ||
echo "* #{$b->id}: {$b->name}\n"; | ||
} | ||
exit; | ||
} | ||
?> |
Oops, something went wrong.