1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

multiple upload updating mysql

Discussion in 'PHP' started by cris02, Jul 13, 2006.

  1. #1
    hello,

    i have the code that upload single file and updating mysql. i have two problem.

    1. they update the database if the record is in the first.
    2. i want to make this into multiple upload.

    here's my code:
    
    <html><head><title>Untitled</title> 
    <style type="text/css"> 
    body { 
       scrollbar-face-color:666666; 
       scrollbar-highlight-color:000000; 
       scrollbar-3dlight-color:000000; 
       scrollbar-shadow-color:000000; 
       background-color: #FFFFFF; 
        } 
    </style> 
    </head> 
    <body> 
    <?php 
    require_once("db.php"); 
    require_once("function.php"); 
    $conn = connectDB(); 
    error_reporting(0); 
    $sql="select * from jobs where file_uploaded='Not Available' LIMIT 1"; 
    $res = doQuery($sql,$conn); 
    $rows = getRow($res); 
    if($rows>0){ 
    while($data=mysql_fetch_array($res)){ 
    $wek=substr(strrchr($data[5],'.'),0); 
       } 
     } 
    $cris=rtrim($filename_name, ".doc"); 
    $ext="client/".$name."/uploads/".$cris.$wek; 
    $exxx="client/".$name."/documents/".$filename_name; 
    $sql="UPDATE jobs SET documents = '$exxx', linecount= '$counts', jobstatus= 'R', date_delivered= '".date('Y-m-d')."' WHERE file_uploaded='$ext' LIMIT 1"; 
    mysql_query($sql) or die(mysql_error()); 
    
    ?> 
    <center><select onChange="JavaScript : document.cris.name.value = this.options[this.selectedIndex].text" name="names" id="names" style="width:32%;"><p><strong>Select client name</strong></p><br><option selected="selected">Select client name</option> 
    <?php 
    $dir=opendir("."); 
    while($file=readdir($dir)){ 
    $type= strrchr($file,'.'); 
       if ($file!="." and $file!=".." and $type=='') {  
        echo "<option value=''>$file"; 
        } 
    } 
    closedir($dir); 
    ?> 
    
    </center> 
    </select> 
    <? 
    $destination=$name."/documents"; 
    echo "<CENTER><table width='32%' border='1' align='center' bordercolor='#000000'><tr><td height='45'><div align='left'><FORM name='cris' ACTION='uploads.php' METHOD=post enctype=\"multipart/form-data\"><p><strong>Choose a file</strong><br><INPUT TYPE='file' width=25% name='filename'><br><strong>Please put the line counts</strong><br><input type='text' name='counts' value=''><input type='hidden' name='name' value=''><input type=\"hidden\" name=\&quot;action\&quot; value=\"uploadProg\"><INPUT TYPE='hidden' name='action' value='upload'><br><INPUT name='submit' TYPE='submit' value='Upload File'></p></FORM></div></td></tr></table>"; 
        if($action==''){$action='noaction';}else{$action=$action;} 
        if($action=='upload') 
        { 
        $filename==$filename_name; 
        $action=('uploadprog'); 
        $destination=$name."/documents"; 
        copy($filename,$destination."/".$filename_name); 
        echo "<center><p>File has been uploaded.</p>"; 
        echo $weks; 
        } 
        if ($filename=="none") {echo("<p><center>No File Selected....</center></p>"); break;} 
        uploadProg($filename,$filename_name); 
        break; 
       ?> 
    </body> 
    </html>
    Code (markup):

    Please help, i really appreciate your help. thankss
     
    cris02, Jul 13, 2006 IP