I have written some codes in php. Sample code fragment is given below:
include('config.php');
require_once "variables.php";
global $uploadID = " " ; //getting error in this line
function uploadImage($wtI,$tbln,$pri,$db){
if(is_array($_FILES)) {
if(is_uploaded_file($_FILES['image']['tmp_name'])) {
$sourcePath = $_FILES['image']['tmp_name'];
$targetFolder = "../upload_images/$wtI/";
if (!file_exists($targetFolder)) {
mkdir($targetFolder, 0777, true);
}
$targetPath = $targetFolder.$_FILES['image']['name'];
while(file_exists($targetPath)){
$targetPath = $targetFolder.uniqid().'-'.$_FILES['image']['name'];
}
if(move_uploaded_file($sourcePath,$targetPath)){
$sql = "UPDATE `$tbln` SET image='".substr($targetPath,3)."' WHERE $pri=$uploadID;";
$result=mysqli_query($db,$sql);
return true;
}
else return false;
}
}
}
The problem is I am getting the following error message while I run my php file:
Parse error:syntax error, unexpected '=', expecting ',' or ';' in C:\wamp64\www\project\php\additem.php on line 6
Is there any solution to this error?