I also have other general use functions that don't seem to work properly, here are those as well:
class Query{
function table($name,$cols){
include 'conx.php';
$query = "
CREATE TABLE $name(
id int AUTO_INCREMENT PRIMARY KEY NOT NULL,
".$cols.",
error varchar(255) NOT NULL,
date date NOT NULL
);
";
$res = mysqli_query($con,$query) or die(mysqli_error($con));
if($res){
echo "Table created";
}else{
echo "Could not run table";
}
}
function select($table,$col,$val){
include 'conx.php';
$query = "
SELECT $col FROM $table WHERE $col='$val';
";
$res = mysqli_query($con,$query);
if($res){
echo "Selected data";
}else{
echo "Could not select data";
}
}
function update($table,$col,$val,$id){
include 'conx.php';
$query = "
UPDATE $table
SET
$col='$val'
WHERE
id='$id';
)
";
$res = mysqli_query($con,$query);
if($res){
echo "Updated value";
}else{
echo "Did not update value";
}
}
}