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:

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.