Skip to content
Permalink
9dbb52fd52
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
31 lines (25 sloc) 859 Bytes
<?php
$hostname = "104.131.59.56";
$username = "renoj";
$password = "renoj";
$database = "renoj";
function getConnected($hostname, $username, $password, $database) {
$mysql_conn_string = "mysql:host=$hostname;dbname=$database";
$database = new PDO($mysql_conn_string, $username, $password);
$database->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
return $database;
}
function getCards($query,$db) {
$query = $db->prepare($query);
if ( !$query->execute() ) {
echo "err";
}
$query->setFetchMode( PDO::FETCH_OBJ );
$data = $query->fetchAll();
return $data;
}
function getCardByID($id, $db) {
$query = "SELECT * FROM cards WHERE id='".$id."'";
return getCards($query, $db)[0];
}
?>