Jump to content

split variable values and define them phpWBA


paynod

Recommended Posts

I have 2 file names, which are uploaded, stored in the variable $files. I want to be able to assign a variable to each file name. What's the best way of doing it?? I want to be able to insert each file into a mysql database on the same line but in different fields.

 

Here is a sample part of my code:

 

        var_dump($files);
print_r(array_slice(array($files),0)); 

        //I want to split this into 2 variables. One for each file name???????
list($file1)=$files;
      
        //insert the values/filenames into mysql fields "itm_pic_name & itm_pic_name2"
        $mysqli = new mysqli(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME);
$this->execSQL("INSERT INTO itm_pic_detail(itm_pic_name,itm_pic_name2,itm_pic_type, itm_pic_size) VALUES (?,?,?,?)", 
array('ssss',$file1,$file1,$type, $size),true);

 

I would really like some input. : :shy:

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.