Jump to content


  • Posts

  • Joined

  • Last visited

Posts posted by Dathremar

  1. To get a "cleaner" code I would recommend something like:

    $location = "MainPageindexAsbuiltsDisplayYr.php?Dept=" . $_GET['Dept'] . "&Yr=" . $_GET['Yr'];
    header("Location: $location");
  2. You are missing semicolons ( ; ) at the end of those lines. Try:

    function choosejob($frmfunction) {
    	if ($frmfunction === 2)
    		smtpmailer($to, $from, $from_name, $subject, $body, $file_path,$files);
  3. 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.

  4. 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.

  5. 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.

  6. 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.


    Ah, okay, I *think* have created the array correctly?

    $share_category = implode(', ', $_POST['share_category']);


    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.

  8. 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.

  9. 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.