Jump to content

harristweed

Members
  • Posts

    346
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by harristweed

  1. I agree with PFMaBiSmAd:

     

    Try this:

     

    $Approved = isset($_POST['priority']);
    if ($Approved)
    {
        $lot_number = trim($_POST['lot_number']);
        $sr_number_ =trim( $_POST['sr_number_']);
        $SubQty = trim($_POST['SubQty']);
        $ItemCode = trim($_POST['ItemCode']);
        $picked_by = trim($_POST['picked_by']);
        
    $sql = "SELECT stock_item, qty FROM wms WHERE stock_item = '$ItemCode' AND lot_number = '$lot_number'";
    $res = mysql_query($sql, $con) or die(mysql_error());
    
    $row = mysql_fetch_assoc($res);
    
    $stock_item = $row['stock_item'];
    $qty = $row['qty'];
    
    if($qty >= $SubQty){
    
    $output = $qty - $SubQty;
    $qty_withdraw = '0.00';
    }
    else{
    $output = '0.00';
    $qty_withdraw = $SubQty - $qty;
    }   
    }
    

  2. I have an export that I use, here is the code, it might point you in the right direction:

    <?php
    include("variables.php");
    
    $link_id = mysql_connect("$db_host","$db_user","$db_password");
             if (mysql_select_db("$db_database", $link_id));
            else
             {
                 echo "connection failed.";
             }
    $select = "SELECT club_nr, first_name, surname, email, address1, address2, postcode, town, province, phone FROM members";                 
    $export = mysql_query($select); 
    $fields = mysql_num_fields($export); 
    for ($i = 0; $i < $fields; $i++) { 
       $header .= mysql_field_name($export, $i) . "\t"; 
    } 
    while($row = mysql_fetch_row($export)) { 
        $line = ''; 
        foreach($row as $value) {                                             
            if ((!isset($value)) OR ($value == "")) { 
                $value = " \t"; 
            } else {
            $value=stripcslashes($value); 
                $value = str_replace('"', '""', $value); 
                $value = '"' . $value . '"' . "\t"; 
            } 
            $line .= $value; 
        } 
        $data .= trim($line)."\n"; 
    } 
    $data = str_replace("\r","",$data); 
    if ($data == "") { 
        $data = "\n(0) Records Found!\n";                         
    } 
    header("Content-type: application/x-msdownload"); 
    header("Content-Disposition: attachment; filename=bridge_club_members.xls"); 
    header("Pragma: no-cache"); 
    header("Expires: 0"); 
    print "$header\n$data"; 
    ?>
    

  3. I’d tackle your requirement like this….

    <?php
    // date function
    function date2mysql($date){
        $day=substr($date,0,2);
        $month=substr($date,3,2);
        $year=substr($date,-4);
        $date=$year."-".$month."-".$day;
        return $date;
    }
    //has the form been posted?
    if($_POST['submit']=="submit"){
        //Get the old customer total
      $customer_count = mysql_result(mysql_query("SELECT COUNT(*) as Num  FROM table_name WHERE condition' "),0) ;
      // format the date and add posted info to database
      $date_to_mysql=date2mysql($_POST['datepicker']);
    
      //update database with post infomation
      
      $number_customers = $new_customers + $customer_count;
      
      //display totals
      echo "<p>Total customerrs =".$number_customers."</p>\n"; 
    }else{
        //display form
            echo "<form id=\"form\"  action=\"$_SERVER[php_SELF]\" method=\"post\" >\n";
            ?>
    <input type="text" name="form_stuff">
    <input type="submit" name="submit">
    </form>
    

  4. <?php
    if($_POST['formSubmit'] == "Submit")
        
        $varUserName = $_POST['username'];
        $varPW = $_POST['PW'];
        $varEmail = $_POST['email'];
        {
            $fs = fopen("testcsv.csv","a");
            fputcsv($fs, array("$varUserName","$varPW","$varEmail","user","title",",category","some text '<a href=\"http://$varUserName.url.com/splash/\">site.com</a>'"));
            fclose($fs);
            
            exit;
        }
    ?>

  5. I think that you can't use a GET in the query, Try

    $id=$_GET['id'];
    $sql = 'SELECT `car_year`, `car_name`, COUNT(*) as `total` FROM `company_inventory` WHERE owner_name = '.$userdata['user_name'].' AND warehouse_id = '.$id.' GROUP BY `car_name`, `car_year` ORDER BY `car_name` ASC';
    $result = mysql_query($sql) or trigger_error($sql . ' has an error<br />' . mysql_error());
    

  6. I can see two errors:

    // Must contain all legal characters
    if (strspn($_POST['user_name'],$span_str) != srnlen($name)) {
    	return false;
    }

    spelling mistake,

    should be:

    // Must contain all legal characters

    if (strspn($_POST['user_name'],$span_str) != strlen($name)) {

    return false;

    }

    and

    if strlen($_POST['user_name']) > 25 {
    	return false;
    }

    missing brackets:

    if (strlen($_POST['user_name']) > 25) {
    	return false;
    }

     

  7. I receive, on average 200 spam emails a day. There is a commercial company spamhaus http://www.spamhaus.org/ that sell their services to ….i’m not sure who. My outgoing email is blocked by this company most of the time,  which is at best very inconvenient . I have never sent spam. This company claim to be fighting spam. Their system clearly does not work but I am subject to the restriction they impose. They are a big fraud.  I must admit, I am very angry and would resort to an action I would not be proud of if I met an employee of this racket. Does anyone know how I can strike back?

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