Jump to content

TeNDoLLA

Members
  • Posts

    762
  • Joined

  • Last visited

    Never

Everything posted by TeNDoLLA

  1. Have you tried submitting the form leaving some fields empty or something similar? Think what the users could do. Do you validate the form data good enough? Checking for empty values etc? Is there any other wai users could insert data to these tables than this form?
  2. 1. You could use hidden fields in the 2nd form. Pass the values from the 1st form to the second and fill the hidden fields with the values of the first form. This way you have the data from both forms when submitting the 2nd form. 2. You could use sessions to store the data, but this way you need to make sure if the user decides to cancel the process you empty these variables so they won't mess up accidentally later in your other scripts anything. 3. You could use AJAX to handle the 1st form results and return desired data from the AJAX call, and show 2nd form and fill in the data if needed and move on to handling the next form.
  3. Well if you have not done any of these how can you know your variables and queries are OK? Add ini_set('display_errors', 1); error_reporting(-1); in the beginning of your scripts to see if there is any errors. And do some variable / query debugging like I said few posts ago to see if your query / variables have the data that you expect them to have.
  4. Yes I think I can help, but I am at work at the moment and I do not have too much extra time to work on big files (if yours is big). Better option would be probably to paste the relevant codes in here on the forum inside the code tags so other people also can read them and maybe find you an answer for your problem. Some questions: 1. What debugging you have done to find out the source of the problem? 2. Do you have error reporting turned on?
  5. A little offtopic, but I would suggest using var_dump($var); instead of echo because this shows you more debug information. If the variable does not reach the page, and you try to use the variable on that page you should get some WARNING something like call to undefined variable or similar. Do you have error reporting also turned on? this in the beginning of your scripts ini_set('display_errors', 1); error_reporting(-1);
  6. You probably want to start doing test cases and echoing/var_dumping the $formtype and $type variables before running the query. Also could echo out the query how does it look like when you do the tests. And see based on this what happens and when, then try to figure out why.
  7. Here is something to get you started, you need to calculate the time left to the expiration from the interval value (which is in seconds). $timeStampFromDb = '1313089928'; $hoursToAdd = 8*60*60; // 8 hours $expireTime = $timeStampFromDb + $hoursToAdd; // time when 8 hours is added to the time from db $now = mktime(); // time at the moment $interval = $expireTime - $now; // if this is negative, time has expired echo 'Time now: ' . date('Y:m:d H:i:s', $now) . '<br>'; // time now formatted echo 'Expire time: ' . date('Y:m:d H:i:s', $expireTime) . '<br>'; // expire time formatted
  8. No there is not. You would need access to local network or router that this user is connected to. And probably even then you could not get it using php.
  9. http://php.net/manual/en/reserved.variables.server.php so according to the manual they are pretty much the same thing.
  10. What exactly do you have inside the variable $file["date"]? A UNIX timestamp or a string like SQL DATETIME ('YYYY-MM-DD HH:MM:SS') or what? I have a feeling you might need to calculate the time what is left manually or using DateTime functions (DateTime usage requires php >= 5.3 though, which would be probably the easiest way).
  11. How about if you do SELECT DISTINCT instead of SELECT in the query I gave you above? Shoud give you result like this: Florida Plantation Florida Winter Park Florida Coral Springs this what you want?
  12. Not sure but if I get what you try to achieve... shoud be like this maybe $ft = $file["date"]; // If this is timestamp you get from db $ftime= $ft + strtotime("+8hours"); $ctime = $ftime - $ft; $ctime = date('H:i:s', $ctime); echo $ctime;
  13. One option for anonymous users is to gather user information and use COOKIE, but this is not very consistent either since cookies can be manipulated or emptied. Another option could be to gather data from anonymous users like user_agent, ip etc. and create profile for them based on this information to database, but its not even close to bullet proof either. If you use sessions, the session will be destroyed when the user closes his browser, unless you again save it somewhere (file/db). And the same problem comes again: how to separate anonymous users from each other.
  14. This should return the rows from the storeList that do not have UPC like in the variable in the wfData table. SELECT wfStoreList.* FROM wfStoreList LEFT JOIN wfData ON wfStoreList.store=wfData.wfstore WHERE wfData.wfupc NOT LIKE '%$at1%'
  15. Nopes, if you try e.g value 726 it will output: 627 instead of 267. It will only flip the numbers around, not arrange them from lowest to highest.
  16. What exactly should be the data out put for your query?
  17. To get inverse results you could use NOT LIKE instead of LIKE. If you just wanna get rid of null values you add to the WHERE part 'AND somefield IS NOT NULL'. You could use implode() to create the query string for the arrayed values or if you need more complicated string you can build the string with foreach(). $vars = array('test1', 'test2', 'test3'); $sql = ''; foreach ($vars as $var) { $sql .= 'some_field LIKE \'%' . $var . '%\' OR '; } $sql = substr($sql, 0, -4); var_dump($sql);
  18. Try this in the beginning of your script error_reporting(-1); ini_set('display_errors', 1); I also made a working example of your class (dosn't have too much validation for the input nor error checking to keep it simple) class Temperature { private $temperature; // Constructor public function __construct($val) { $this->temperature = $val; } // Function to set temp, $temperature inside class is always in celcius. public function setTemp($val, $unit) { $unit = strtolower($unit); if ($unit === 'c') { $this->temperature = $val; } else if ($unit === 'f') { // Convert fahrenheit to celsius. And assign it to class variable. $this->temperature = (($val - 32) / 1.; } } public function convertToFahrenheit() { return ($this->temperature * 1. + 32; } public function getTemp($unit) { $unit = strtolower($unit); if ($unit === 'c') { return $this->temperature; } else if ($unit === 'f') { return $this->convertToFahrenheit(); } else { return 'Invalid unit type.'; } } } $temp = new Temperature(100); echo "In Fahrenheit: " . $temp->getTemp('c') . '<br>'; echo "In Fahrenheit: " . $temp->getTemp('f') . '<br>'; echo "In Fahrenheit: " . $temp->getTemp('X') . '<br>';
  19. Do you have error reporting turned on ?
  20. This else ($units === "f") { return convertToFahrenheit($val); } should be else ($units === "f") { return $this->convertToFahrenheit($val); } plus you need to remove the semicolon after this function declaration private function convertTemp($val, $units = "c"); // <--- there is extra semicolon that doesnt belong there
  21. Was going to post exactly the same earlier, but assumed the manix's version worked just fine when I tested it with only the given test value Good feature in this method is also that the number can be longer or shorter than 3 digits and it still works.
  22. With the method you are using. This line <?php echo "<a href='view.php?id={$row['id']}'>View Ticket</a>" ?> should be <?php echo "<a href='view.php?id={$f1}'>View Ticket</a>" ?>
  23. I would suggest using radio button for this.
  24. Change it to (your string concencation is fucked up, the quotes in it) $stringData .= '<img src="' . $row['image_path'] . '"/>';
  25. You could just check against !empty(trim($var)) alone. trim() will get rid of extra white spaces.
×
×
  • 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.