Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $srv = localhost;
- $usr = username;
- $pw = password;
- $db = databas;
- try {
- $dbh = new PDO("mysql:host=$srv;dbname=$db", $usr, $pw);
- $sql = "SELECT wins, gameplayed FROM score;";
- foreach ($dbh->query($sql) as $data)
- {
- $wins = $data['wins'];
- $gamesplayed = $data['gamesplayed'];
- $loses = $wins - $gamesplayed;
- echo $loses;
- }
- $dbh = null;
- }
- catch(PDOException $e)
- {
- echo $e->getMessage();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement