Inherited Series of Functions/Code that Are Broken

Hi. The process is this: Query MySQL database for customer images. Make a directory on MySQL database server. Copy images from remote (images) server to directory on MySQL database server. When I follow the code process, the directory on the MySQL database server is never written:

$foo = sprintf("mkdir \"/home/customer/images/_Retrieve/%s\"",$name);
system($foo);
echo $foo."<br>";

This should make a folder with the customer’s name, for example, “Mike James” located in /home/customer…

It isn’t doing this. It is just printing (echo) what it looks like it is doing to the next webpage. Any ideas where I should start looking for where the code is breaking?

Thanks for your help thinking about this.

Use php functions instead of executing system commands
http://php.net/manual/en/function.mkdir.php

I’m sorry, I have never written C+ or PHP before and I am trying to decipher what our last programmer left----

Thank you JimL, I can write new folders in the home directory using the mkdir function. Do you know off hand how to include the custom $name variable as part of the path string when using mkdir? Our programmer defined the $name variable by querying the MySQL database.

mkdir("/home/customer/ ----- );
I want to add something like this mkdir("/home/customer/$name); then copy the images to this folder with the customer’s name, I just don’t know the syntax at the end of the function.

Sponsor our Newsletter | Privacy Policy | Terms of Service