Skip to content

Commit

Permalink
Merge pull request #3 from khaoulamerah/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
khaoulamerah authored Dec 15, 2024
2 parents d73c17d + 16c78e9 commit f4254cd
Show file tree
Hide file tree
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.
24 changes: 24 additions & 0 deletions back-end/conn.php
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;
}
?>
Loading

0 comments on commit f4254cd

Please sign in to comment.