Jump to content

harristweed

Members
  • Posts

    346
  • Joined

  • Last visited

  • Days Won

    1

Everything 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 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();
  4. $cDiff = mysql_query("SELECT COUNT(DISTINCT cCode) AS number FROM onlinenow");
  5. 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>
  6. 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?
  7. 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!
  8. 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....
  9. <?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; } ?>
  10. try changing this line. to this: $query .= "WHERE branch = '$branch' ";
  11. Have a look at: http://www.alohatechsupport.net/webdesignmaui/maui-web-site-design/easy_jquery_auto_image_rotator.html
  12. <?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"; } ?>
  13. 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());
  14. Possibly: $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; Might be the reason, why not try: $headers .= "Content-Type: text/html; charset=UTF-8\n";
  15. http://www.tizag.com/mysqlTutorial/mysqlcount.php
  16. post full code - error might be before this line
  17. try: <?php if(!empty($errors)){ echo '<form action="confirmation.php" method="POST">'; }else{ echo '<form action="register.php" method="POST">'; } ?>
  18. 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; }
  19. They have an answer phone and don't respond to email.
  20. 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?
  21. It looks like the error is on line 81. There is a closing brace and no opening brace above it. I think that there should be something like: <?php if($_POST['submit']=="submit") { ?> at the top of the code...
  22. $info = mysql_fetch_array($data); Should be: $info = mysql_fetch_array($data, MYSQL_ASSOC); http://es2.php.net/manual/en/function.mysql-fetch-array.php but I think better to use: $info = mysql_fetch_assoc($data);
  23. have you got a file named 'authorize_1.php' in the same folder as your authorization script?
×
×
  • 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.