php - Uploading of files and saving -


back again

so have moved code around bit , unsuccessfull message. please tell me , doing wrong.

my form on editemployee.php page

<h1>warnings</h1> <div class="article" style="width:535px">  <form enctype="multipart/form-data" action="includes/add.php" method="post">   <table>   <tr>   <td>warning letter:</td>   <td> <input type="file" name="warning1"></td>   </tr>    <tr>   <td>warning letter:</td>   <td><input type="file" name="warning2"></td>   </tr>    <tr>   <td>warning letter final:</td>   <td><input type="file" name="warning3"></td>   </tr>    <tr>   <td></td>   <td><input type="submit" value="add"> </td>   </tr>   </table>   </form>   </div> 

an have move processing code suggested own file called add.php

<?php    //this directory images saved  $target = "files/empdocs";  $target1 = $target . basename( $_files['warning1']['name']);  $target2 = $target . basename( $_files['warning2']['name']); $target3 = $target . basename( $_files['warning3']['name']);   //this gets other information form    $warning1=($_files['warning1']['name']);   $warning2=($_files['warning2']['name']);  $warning3=($_files['warning3']['name']);    // connects database   mysql_connect("localhost", "username", "password") or die(mysql_error()) ;   mysql_select_db("database") or die(mysql_error()) ;     //writes information database   mysql_query("insert ref_employees values ('$warning1', '$warning2', '$warning3')") ;   //writes file server  if (move_uploaded_file($_files['warning1']['tmp_name'], $target1) && move_uploaded_file($_files['warning2']['tmp_name'], $target2) && move_uploaded_file($_files['warning3']['tmp_name'], $target3)) {   //tells if ok   echo "the file ". basename( $_files['uploadedfile']['name']). " has been uploaded, , information has been added directory";   }   else {    //gives , error if not   echo "sorry, there problem uploading file.";   }   ?> 

you have:

mysql_query("insert ref_employees values ('$warning1', '$warning2', '$warningfinal') 'idnumber' = $idnumber") ;  

where should not in insert statement!


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -