Jump to content

jvrothjr

Members
  • Posts

    299
  • Joined

  • Last visited

Everything posted by jvrothjr

  1. I tried uploading the files but I have found a link between the code written and register_globels = on because the way the old code was created. Simple fix is to turn if off and the Session_register should work. But still looking for better options.
  2. I have attached the file in question. this is the page loaded in the IFrame once the values are set in this page its not using the Sessions Variables in the main page.
  3. 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
  4. $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.
  5. 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 }
  6. 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.
  7. 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)
  8. 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
  9. fixed it right after I posted sorry Next issue Notice: Undefined index: cmd in C:\wamp\apps\testrequest\index.php on line 253 switch($_REQUEST['cmd']){
  10. ok used but still getting error if (substr($_SERVER['HTTP_REFERER'],-10) != "header.php") {$_SESSION[referer] = $_SERVER['HTTP_REFERER'];} Notice: Use of undefined constant referer - assumed 'referer' in C:\wamp\apps\testrequest\includes\pconvar.inc on line 2
  11. so replace if (substr($_SERVER['HTTP_REFERER'],-10) <> "header.php") {$_SESSION[referer] = $_SERVER['HTTP_REFERER'];} with if (substr($_SERVER['HTTP_REFERER'],-10) <> "header.php") { $referer = $_SERVER['HTTP_REFERER']; $_SESSION[referer] = $referer; }
  12. I have been asked to update are software we are running I have been able to get the new versions update running but am having issues with SESSION_REGISTER and declaring session variables. can someone just point me in the right direction. I have seem sessions_reg goes away in php 5.6 so any help to switch now would be great.
  13. 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; }
  14. use the limit function of the query.
  15. you want your page to be a proxy?
  16. Good Point what if then use the else statement.
  17. 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"
  18. 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; }
  19. 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.
  20. 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."'";
  21. Look into JOIN to join the two tables in the query
  22. thanks will try it in the morning
  23. 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?
  24. opps if (mysql_num_rows($result) > 0) { // yes // print them one after another echo "<table border=0 cellspacing=0 cellpadding=0 class=box_width_cont product>"; echo "<tr>"; echo "<td colspan=2>--------------------------------------------------------------------------------"; echo "</td>"; echo "</tr>"; while($row = mysql_fetch_row($result)) { $i++; if ($i == '1') {echo "<tr>";} // first cell echo "<td><center><img height=125 width=175 src=".$row[1]."></center>"; echo "<center><font color=#855b63>".$row[2].$row[3].$row[7]." Cut Size: ".$row[4]."</font><font color=#855b63 size=3>".$row[10]."</center></font>"; echo "<center><a href=items/".$row[0].".php><img src='images/button_details.gif'>[/url]</center>"; echo "</td>"; if ($i == '2') {echo "</tr>";$i='0'} } echo "</table>"; } else { // no // print status message echo "No items found!"; }
×
×
  • 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.