Skip to content
Open

PHP8 #25

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions tableManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ class tableManager {
var $nonceKey;
/** @var array array holding key of field name and value of URL to wrap field in */
var $fieldLinks;
/** @var PDO object handle to information_schema */
var $mysqlDb;

/**
* tableManager constructor - establishes a connection to a database and a specific table
Expand All @@ -64,7 +66,7 @@ class tableManager {
* @param int string $port defaults to '3306'
* @throws Exception if table name doesn't exist in database
*/
function __construct($host, $username, $password = '', $database, $table, $type = 'mysql', $port = '3306')
function __construct($host, $username, $password, $database, $table, $type = 'mysql', $port = '3306')
{
$this->host = $host;
$this->username = $username;
Expand Down Expand Up @@ -538,7 +540,8 @@ public function valueExists($key, $value){
$query->bindValue(':value', $value, PDO::PARAM_STR);
$query->execute();
$result = $query->fetch(PDO::FETCH_ASSOC);
if ($result['count'] === "0"){
# use == rather than === because some versions return int and others string
if ($result['count'] == "0"){
return false;
} else {
return true;
Expand Down Expand Up @@ -742,7 +745,8 @@ private function validateTableName($table){
$query->bindValue(':database', $this->database, PDO::PARAM_STR);
$query->execute();
$result = $query->fetchAll(PDO::FETCH_ASSOC);
if ($result[0]['count'] === "1") {
# use == rather than === because some versions return int and others string
if ($result[0]['count'] == "1") {
return true;
} else {
return false;
Expand All @@ -764,7 +768,8 @@ private function validateTableColumns($rowsArray){
$query->bindValue(':column', $column, PDO::PARAM_STR);
$query->execute();
$result = $query->fetchAll(PDO::FETCH_ASSOC);
if ($result[0]['count'] !== "1") {
# use != rather than !== because some versions return int and others string
if ($result[0]['count'] != "1") {
return false;
}
}
Expand Down