Skip to content
Snippets Groups Projects
Commit 3c3928ef authored by KELBERT Paul's avatar KELBERT Paul
Browse files

site

parent df07e3c3
No related branches found
No related tags found
No related merge requests found
Showing
with 954 additions and 21 deletions
# SÉANCE 1 # SÉANCE 1
\ No newline at end of file
LANCER INDEX.PHP DANS LE DOSSIER "SEANCE"
NE PAS OUBLIER DE MODIFIER LE FICHIER CONF.INI POUR ACCEDER A LA BASE DE DONNEES
\ No newline at end of file
-- Partie 2--
-- 1
select id, name from game where name like '%mario%';
-- 2
SELECT id, name from company where location_country = 'Japan';
-- 3
select id, name from platform where install_base >= 10000;
-- 4
select name, deck from game order by name;
-- 5
select id, name from game where id > 21173 LIMIT 442;
<?php
require 'vendor/autoload.php';
use seance\reponse\CQuestion1;
$q = new CQuestion1();
\ No newline at end of file
<?php
require 'vendor/autoload.php';
use seance\reponse\CQuestion2;
new CQuestion2();
\ No newline at end of file
<?php
require 'vendor/autoload.php';
use seance\reponse\CQuestion3;
new CQuestion3();
\ No newline at end of file
<?php
require 'vendor/autoload.php';
use seance\reponse\CQuestion4;
new CQuestion4();
\ No newline at end of file
<?php
require 'vendor/autoload.php';
use seance\reponse\CQuestion5;
new CQuestion5();
\ No newline at end of file
{
"require":{
"illuminate/database": "5.5.*",
"php": ">=7.3"
},
"autoload":{
"psr-4": {
"seance\\" : "src/"
}
}
}
This diff is collapsed.
driver=mysql
username=root
password=
host=localhost
database=applibd
\ No newline at end of file
<?php
require 'vendor/autoload.php';
use seance\modele\Game;
echo "<a href='Question1.php'>question 1</a><br>";
echo "<a href='Question2.php'>question 2</a><br>";
echo "<a href='Question3.php'>question 3</a><br>";
echo "<a href='Question4.php'>question 4</a><br>";
echo "<a href='Question5.php'>question 5</a><br>";
<?php
namespace seance\modele;
class Character extends \Illuminate\Database\Eloquent\Model
{
protected $table = 'character';
protected $primaryKey = 'id';
public $timestamps = false;
}
\ No newline at end of file
<?php
namespace seance\modele;
class Company extends \Illuminate\Database\Eloquent\Model
{
protected $table = 'company';
protected $primaryKey = 'id';
public $timestamps = false;
}
\ No newline at end of file
<?php
namespace seance\modele;
class Game extends \Illuminate\Database\Eloquent\Model
{
protected $table = 'game';
protected $primaryKey = 'id';
public $timestamps = false;
}
\ No newline at end of file
<?php
namespace seance\modele;
class Platform extends \Illuminate\Database\Eloquent\Model
{
protected $table = 'platform';
protected $primaryKey = 'id';
public $timestamps = false;
}
\ No newline at end of file
<?php
namespace seance\reponse;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use seance\modele\Game;
use Illuminate\Database\Capsule\Manager as DB;
class CQuestion1
{
public function __construct()
{
echo "<a href='index.php'>Retour au menu</a><br><br>";
$file = parse_ini_file('conf.ini');
$db = new DB();
$db->addConnection($file);
$db->setAsGlobal();
$db->bootEloquent();
$c = Game::where("name", "like","%mario%")->get();
foreach ($c as $char) {
echo $char->name . "<br>";
}
}
}
\ No newline at end of file
<?php
namespace seance\reponse;
use Illuminate\Database\Capsule\Manager as DB;
use seance\modele\Company;
class CQuestion2
{
public function __construct()
{
echo "<a href='index.php'>Retour au menu</a><br><br>";
$file = parse_ini_file('conf.ini');
$db = new DB();
$db->addConnection($file);
$db->setAsGlobal();
$db->bootEloquent();
$c = Company::where("location_country", "=","Japan")->get();
foreach ($c as $char) {
echo $char->id . " " . $char->name . "<br>";
}
}
}
\ No newline at end of file
<?php
namespace seance\reponse;
use Illuminate\Database\Capsule\Manager as DB;
use seance\modele\Platform;
class CQuestion3
{
public function __construct()
{
echo "<a href='index.php'>Retour au menu</a><br><br>";
$file = parse_ini_file('conf.ini');
$db = new DB();
$db->addConnection($file);
$db->setAsGlobal();
$db->bootEloquent();
$c = Platform::where("install_base", ">=","10000")->get();
foreach ($c as $char) {
echo $char->id . " " . $char->name . "<br>";
}
}
}
\ No newline at end of file
<?php
namespace seance\reponse;
use Illuminate\Database\Capsule\Manager as DB;
use seance\modele\Game;
use seance\modele\Platform;
class CQuestion4
{
public function __construct()
{
echo "<a href='index.php'>Retour au menu</a><br><br>";
$file = parse_ini_file('conf.ini');
$db = new DB();
$db->addConnection($file);
$db->setAsGlobal();
$db->bootEloquent();
$c = Game::orderBy('name')->get();
foreach ($c as $char) {
echo $char->name . " " . $char->deck . "<br>";
}
}
}
\ No newline at end of file
<?php
namespace seance\reponse;
use Illuminate\Database\Capsule\Manager as DB;
use seance\modele\Game;
use seance\modele\Platform;
class CQuestion5
{
public function __construct()
{
echo "<a href='index.php'>Retour au menu</a><br><br>";
$file = parse_ini_file('conf.ini');
$db = new DB();
$db->addConnection($file);
$db->setAsGlobal();
$db->bootEloquent();
$c = Game::where('id', '>', 21173)->limit(442)->get();
foreach ($c as $char) {
echo $char->id . " " . $char->name . "<br>";
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment