Having some trouble with PHP static functions in my program. My code is below and I keep getting the error "Anonymous function expected". I'm using the IDE PhpStorm.
I've had a google but nothing comes up. If I remove the name of the function the error goes away but I don't know how to then call the function.
<?php
/**
* @param mysqli $conn Connection to the database.
* @param int $id The ID of the white card that is to be voted up.
*/
public static function voteUp($conn, $id){
mysqli_query($conn, 'UPDATE WhiteCards SET Ups = Ups + 1 WHERE ID = ' . $id);
}
/**
* @param mysqli $conn Connection to the database.
* @param int $id The ID of the white card that is to be voted down.
*/
public static function voteDown($conn, $id){
mysqli_query($conn, 'UPDATE WhiteCards SET Ups = Ups - 1 WHERE ID = ' . $id);
}
publicsuggests the use of a class; you also want to know how to call the functions; this question is both unclear and too broad. Best you go back to reading all the relevant manuals.