Jump to content

harristweed

Members
  • Posts

    346
  • Joined

  • Last visited

  • Days Won

    1

harristweed last won the day on May 10 2018

harristweed had the most liked content!

About harristweed

  • Birthday 03/01/1947

Contact Methods

  • ICQ
    1

Profile Information

  • Gender
    Male

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

harristweed's Achievements

Newbie

Newbie (1/5)

1

Reputation

  1. I have been helped by lots of PHPFreakers during my years as a PHP script writer. I am now 71 years old and have decided it's time to hang up my mouse. So thanks to all those that have taken the time to point me in the right direction over the last few years. Harristweed
  2. 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; } }
  3. 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"; ?>
  4. I did this some time ago and it seemed to work! set $i=0 outside of the 'loop' then have this code inside the 'loop' $i++; $nl=$i % 100; if($nl==0)echo"<br />$i Records processed<br />"; echo"|"; ob_flush(); flush();
  5. $cDiff = mysql_query("SELECT COUNT(DISTINCT cCode) AS number FROM onlinenow");
  6. 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>
  7. I’m still confused! Do you want a single page (form) that displays information from the database with the option to add more items or edit the existing ones?
  8. I change the date value, using the function after the form has been submitted. The received post values are inserted into a mysql database after they have been sanitised and the function applied to the date variable!
  9. I have a datepicker that is formatted to show dates dd/mm/yyyy to add them to mysql database I use a function to 'amend' the format: function date2mysql($date){ $day=substr($date,0,2); $month=substr($date,3,2); $year=substr($date,-4); $date=$year."-".$month."-".$day; return $date; } perhaps you could do something similar....
  10. <?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; } ?>
  11. try changing this line. to this: $query .= "WHERE branch = '$branch' ";
  12. Have a look at: http://www.alohatechsupport.net/webdesignmaui/maui-web-site-design/easy_jquery_auto_image_rotator.html
  13. <?php $array1 = array(1, 2, 3); $array2 = array(4, 5, 6); $array3=array_merge($array1, $array2); foreach ($array3 as $key => $value) { echo"key = $key value = $value<br />\n"; } ?>
×
×
  • 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.