I need that data which be taken from mySQL table, be used as part a directory of saving path.
The code is:
<?php
$dbconnection = mysql_connect('localhost', 'root', '');
if(!$dbconnection)
{
die('Login error: ' . mysql_error());
}
$fold_path = mysql_result(mysql_query("SELECT fold_path FROM clients WHERE id = 16"),0);
mysql_close($dbconnection);
$uploaddir = getcwd().DIRECTORY_SEPARATOR.'files'.DIRECTORY_SEPARATOR.$fold_path.DIRECTORY_SEPARATOR;
$uploadfile = $uploaddir.basename($_FILES['file']['name']);
if(!is_dir($uploaddir)) mkdir($uploaddir) ;
move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile);
?>
fold_path field got a type: varchar(100)
When i trying to save file, its ignoring variable, taken from table and determine its as null.
Here is debug information, when i try to use different ways.
Output $fold_path through echo: directory
Output $uploaddir through echo: ..\mydomain\upload\directory\
Output $fold_path in text file through fwrite: // here is null
Output $uploaddir in text file through fwrite: ..\mydomain\upload\\