Jump to content

jvrothjr

Members
  • Posts

    299
  • Joined

  • Last visited

Posts posted by jvrothjr

  1. I am In the process of updating to a Newer machine. With this I am converting code over to use Apache 2.4.20 / PHP 5.6.22 / MySQL 5.7.13. I have updated code connections to MySQL. Everything on the View/Display on the Web site is working correctly.  The issues I am having are on the modification of data.

     

    Issue 1)

    I have a New/Edit form the has an IFRAME in it. On the IFRAME page there is a onchange.form.submit() with _POST the values are correctly redisplayed on the IFRAME, put when form is submitted the values are not pasted to the main page from the IFRAME.

     

    Issue 2)

    I have a query string that is set to insert, I can run the query string in SQLyog and it works with warning messages but the inert string fails using php/MySQL. is there an easy fix for this. I know I could rebuild query string based on if Var Is Null. eliminating "Blank" inserts.

     

    If there is a switch or variable I can switch in apache/php/MySQL that would help resolve these issues that would be great

     

    Hoping someone could point me in the right direction to find a solution.

     

    Currect Machine is running Apache 2.2.22/ PHP 5.2.1/MySQL 5.0.51a

  2. $foo = (isset($_POST['foo'])) ? trim($_POST['foo']) : false;

    if($foo !== false)

    {

    //Do something

    }

     

    This is along the lines i think he intended for it to be used

     

    The function was only to execute if the variable was set.

  3. Thanks Psycho at least some are willing to help in place of complaining.

     

    I have a page that uses all these forms and create different issues on the same page and just trying to get it standardized and working right on the newest php version.

     

    Because it is not acting the same as it was on php 5.2.1 as 5.4.3.

     

    I have added this string to see if post is null if not then set the $var which helps stop setting value on first page load if the value is set within the page.

     

     

    if ($_POST['foo']) {$var = $_POST['foo'];}

    if(isset($var))

    {

    //Do something

    }

  4. C. Your explanations of the code are incorrect. Are you asking what the code does? The manual explains it, as well as how they've changed from version to version.

     

    if so what is the correct definition.

  5. I have used this forum for years as ref but not any more.

     

    Please delete this post and remove My ID from this Forum I have got nothing but neg with the

     

    last few posts I will take my questions and skills else where. Use to be staff would just move the post but now they warn and complain.

     

    and there is a question in this post if you read it

     

    (this has issues in 5.4 I am replacing but what is the best replacment)

  6. I am working on updating code to work in 5.4 php and am having some issues with IF statements and reaction

     

    IF(empty($var) = check if 0,empty or not set

    IF(isset($var)) = check if set (this has issues in 5.4 I am replacing but what is the best replacment)

    IF(!$var) = check not set

    IF($var) = Check if set

    IF($var1 <> $var2) = Replace with IF($var1 != $var2)

     

     

    Just trying to understand. I did not write all the code but am trying to standardize on a common format

  7. I am having some issues with getting dates for the days of the week based on one date givin

     

    Example:

    User enters date for sunday. (Ending pay period) and I wish to get the dates for that week.

    Mon - 1-2-2012

    Tue - 1-3-2012

    Wed - 1-4-2012

    Thu - 1-5-2012

    Fri - 1-6-2012

    Sat - 1-7-2012

    Sun - 1-8-2012

     

    User would enter 1/8/2012 and the script would get the rest of the dates to enter into the timecard.

     

    I have tried both ways below and cant get it to work no mater if i change the user input date i still get the same output.

     

    Function getdatepast($dtp,$cnt) {

    $undatecon = mktime($dtp);

    $undatecon2 = strtotime("-".$cnt." day", $undatecon);

    $ddt1 = date('m-d-Y',($undatecon2));

                    return $ddt1;

    }

     

    Function getdatepast($dtp,$cnt) {

    $undatecon = mktime($dtp);

    $undatecon2 = $undatecon - (86400 * ($cnt));

    $ddt1 = date('m-d-Y',($undatecon2));

                    return $ddt1;

    }

     

  8. Akron, Ohio Area

     

    We are starting to look for local area programmer or remote programmer for an assigned task.

     

    We are is the process of interviewing to hire a firm or individual that can and will complete a task on time & on Budget.

     

    We currently have a home grown site running to manage are testing and looking to have some code cleanup / or redesign completed first.

     

    Then as the main part of the project:

     

    We are looking to have an App (or Plug-in) created that will be about to schedule as well as manage auto-rescheduling based on priority changes.

     

    There will be four groups

    1) Personal

    2) Test Area

    3) Equipment

    4) Test Request

     

    Items predefined

    Test requirement (Test Request) - Who (Personal), What (Equipment), Where (Test Area), Time (Length)

     

    When someone writes a request for a test, they select the test and all the who, what, where, Time is predefined. Then the scheduler will give with data (who, what, where, time) an estimated time to completion is returned, as well as place this request into the schedule of all required (Who, What, Where)

     

    But also will have the ability to reschedule all four groups by selecting the "Test Request" and move it in the schedule and all the linked (who, what, where) will be auto rescheduled.

     

    This Site is in-house only (LAN) and not accessible out side the company

     

    Web Server: Apache

     

    Database: MySQL

     

    Programming: Perl, ActiveX, PHP

     

    Hardware: Standalone PC

  9. only need 5 out of 20 fields

    SELECT id, name, age, address, company FROM table1
    

    would be better

     

    Second

    $query="SELECT table.id, table1.name, table2.age, table2.address FROM table1 left join table2 on table1.field1 = table2.field2"
    

  10. Now the Variables methed is POST. Only thing needed passed in the table name this looks at the field names of the table to build the query string then pass the query back to the calling function.

    Function InsertValues($table) {
    	$qst1 = 0; // Record Count Field Name
    	$chk1 = 0; // Loop Check Field Name
    $qst2 = 0; // Record Count Field Value
    // Query table for all records
    $querystring = "Select * from ".$table;
    // Begin creation of insert qeury string
    $QSPI = "Insert into ".$table." (";
    // Get results of field names 	
    $result=mysql_query($querystring);
    // Loop thru field names
    while(($field = mysql_fetch_field($result)))
    {
    // If field Not Null the continue
    	IF ($_POST[$field->name] != "") {
    // Set counter		 
    		$qst1++; 
    // Set a variable as array and set value to field name
    		$QS1[$qst1] = $field->name;
    // Set temp variable holder to field value			
    		$fn1 = $_POST[$field->name];
    // Check value if it is on/off set values to 1/0 this is used for checkboxs			
    		if ($_POST[$field->name] == "on") {$fn1 = "1";}
    		if ($_POST[$field->name] == "off") {$fn1 = "0";}	
    // Set Second Array value to value
    		$QS2[$qst1] = $fn1;
    	}
    }
    // loop thru first Array to set the field names	
    for ($qstL1 = 0; $qstL1 <= $qst1; $qstL1++) {
    	if ($QS1[$qstL1] != '') {
    		if ($chk1 == 0) {
    			$tmpqs1 = $QS1[$qstL1];
    			$chk1 = 1;
    		} else {
    			$tmpqs1 = $tmpqs1.",".$QS1[$qstL1];
    		}
    	} 
    }
    // Add to query string
    $QSPI = $QSPI.$tmpqs1.") values(";
    // loop thru second Array to set the vales for the fields
    for ($qstL2 = 0; $qstL2 <= $qst1; $qstL2++) {
    	if ($QS2[$qstL2] != '') {
    		$chkstr = substr($QS1[$qstL2], 0, 4);
    		$chkstr1 = substr($QS1[$qstL2], strlen($QS1[$qstL2]) - 4, 4);
    		if ($chk2 == 0) {
    // if field name starts with date call the date function to set the format of the date correctlly
    			if ($chkstr == "date") {$QS2[$qstL2] = input2date($QS2[$qstL2]);} 
    			if ($chkstr1 == "Date") {$QS2[$qstL2] = input2date($QS2[$qstL2]);} 
    			$tmpqs2 = "'".$QS2[$qstL2]."'";
    			$chk2 = 1;
    		} else {
    // Function to format date
    			if ($chkstr == "date") {$QS2[$qstL2] = input2date($QS2[$qstL2]);} 			 
    			if ($chkstr1 == "Date") {$QS2[$qstL2] = input2date($QS2[$qstL2]);} 			 
    			$tmpqs2 = $tmpqs2.",'".$QS2[$qstL2]."'";
    		}
    	} 
    }
    // Complete the definition of the query string
    $QSPI = $QSPI.$tmpqs2.")";
    // Pass the completed query string back to the calling function
    return $QSPI;
    }
    

  11. this a dynamic building query function? If so I have a function that builds based on field name that contain data.

     

    You pass the table name then it builds the insert query based on if the [fieldname] variable is $_POST[varname].

     

    if not data is passed for that field it drops that field from the insert statement.

     

  12. You can Query for the AVG, MIN, MAX, STD of a field see examplebelow

    $string1e = "SELECT 
    round(AVG(IR_100_kA),2) as Avg_IR_100_kA, 
    round(MIN(IR_100_kA),2) as Min_IR_100_kA, 
    round(MAX(IR_100_kA),2) as Max_IR_100_kA, 
    round(STD(IR_100_kA),2) as Std_IR_100_kA
    FROM tblhighcurrent where QA_Block_Batch_ID = '".$QA_Block_Batch_ID."'";
    

  13. I have a page that is used to enter data into 45 fields.

     

    The question is can I or is there away to have the enter act as tab so when the hit enter it tab's to the next field?

     

    I can disable the enter key but I need it to tab to the next field?

     

    any ideas?

     

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