Jump to content

Dathremar

Members
  • Posts

    169
  • Joined

  • Last visited

Everything posted by Dathremar

  1. I am sorry, but I don't see where you pull anything from the db. Could you explain a bit better where/what is the problem?
  2. To get a "cleaner" code I would recommend something like: $location = "MainPageindexAsbuiltsDisplayYr.php?Dept=" . $_GET['Dept'] . "&Yr=" . $_GET['Yr']; header("Location: $location");
  3. You are missing semicolons ( ; ) at the end of those lines. Try: function choosejob($frmfunction) { if ($frmfunction === 2) { create_zip($file_path,$files,$zipname); } else { smtpmailer($to, $from, $from_name, $subject, $body, $file_path,$files); } } choosejob($frmfunction);
  4. You can stick to your query and just add this in the where clause, when you are searching for letter 't': AND ((SUBSTRING(title,1,3) <> 'the')
  5. I don't know if this question deserves an answer, but just googling what you wrote here, got me this as a first response: http://elementdesignllc.com/2011/06/generate-random-10-digit-number-in-php/ So please don't be that lazy and try using google from time to time.
  6. You can do something like: Select table1.*, table2.field as t2field, table3.field as t3field .. Use the * for the table where you need all of the columns and from the other tables specify which fields you need and add "as" where needed (fields that have same name in more tables). Avoid using the "*" when doing a select. Its not a good practice. Always fetch only the fields you need. Fetching more data then needed is never a good idea.
  7. Yes, but that should throw a query error that you have ambiguous field name. But that can be solved by adding in the query something like: SELECT table1.field1 as t1field1, table2.field1 as t2field1, table3.field1 as t3field1 ..... So then you can pull out the field you need with $row['t1filed1'], $row['t2field1'] and so on.
  8. First of all - never use the $_POST values directly in the query!!! Clean the values and validate them before using. Now for your problem. Like Barand pointed out, your update query will affect all the rows that are equal to what ever you have in the $_POST['hidden'] or if you removed that it will be every row that has product = ''. Figure out a uniqe key for the row that you want to update and put that in you where clause.
  9. I agree, but You will need a fallback for olderbrowsers (if you support them, iex. IE7).
  10. I see. $_SESSION['share_category'] is set, but it is empty (has not value). Change your if condition to: $selectedCategories = (isset($_SESSION['share_category']) AND !empty($_SESSION['share_category'])) ? $_SESSION['share_category'] : array();
  11. I am sorry if I don't understand your problem right, but my opinion is that you would like to use cookies. If it is some info that you need to preserve for a user, put that value in a cookie and check for that cookie on page load and ofcourse if you find the needed value do whatever you need to do with that.
  12. I was going to GUESS what you mean and try to help you, but after reading this, my will is gone.
  13. The $_POST['code'] can be your id field from the db, so add that to the query instead of the hardcoded id = 1. Also don't forget to clean and validate the $_POST param before using it inside a query.
  14. Yes you can, but not with php, You will need javascript for doing that. To set an event on that link and do what you want to do.
  15. If you want you in-function changes to have effect on a global variable, like You said pass that variable by reference inside the function and change it.
  16. The $share_category variable that you are crating is a string and not an array. Dont implode it (which creates the string), just use it as an array. Add all of the checked values to an array with: array_push($array_name, $value); which is the same as: $array_name[] = $value; And then the condition with in_array will work, since the second param should be the array to search in.
  17. Use this http://www.php.net/manual/en/function.json-decode.php to get the result out of that string. That is JSON object that you can use.
  18. Take a look at ths php function: http://www.php.net/manual/en/function.preg-match.php Use a regex to find the matches and do what you want with that.
  19. I dont know what You have inside those params ($time, $date), but in order to get that date 04/30/2013 into a date field in the db you need to get it into this format: yyyy-mm-dd.
  20. As the documentation says http://www.php.net/manual/en/function.substr.php string substr ( string $string , int $start [, int $length ] ) You need to put something like: $code = substr($file_contents, $start, ($end - $start));
  21. What You have is correct. If there is 12 in the array it will print yes.
  22. I don't understand whats the question here. What do You need help with?
  23. I am guessing that monkuar needs this to toggle some element on client side. So the logic should be if ?hide=1 and 1 is in the cookie remove it otherwise add it. Same thing for ?hide=2. So in order to do this, You need to get the cookie content ($_COOKIE['cookie_name']) check if the value is in there and set the new value.
  24. True what You say that the widest div gives the width of the box. The problem is (and I think it is only in IE9) that when the width of the div should be determined by the width of the description row, it pushes the floated span in the next row. There is nothing more to the code because this is a absolute positioned div on the screen (like a lightbox)
×
×
  • 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.