Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. DRJ478

    Monthly Job?

    The PHP method only works if PHP is installed as CGI. If it is an Apache module command line PHP won't work. Your solution is ok, but anyone could trigger that script through the web - unless you have taken precautions in the script to allow execution only from e.g. the IP of the host or...
  2. DRJ478

    Send email that its content created in HTML

    You will need to use multi-part mail. The best class to use for this is PHPMailer, available at http://phpmailer.sourceforge.net You could try to write it yourself, but there is no need to reinvent the wheel. There should be a part of the mail for HTML and a plain text alternative part. That...
  3. DRJ478

    trouble controlling session var

    The error lies in the fact that a single equal sign performs an assignment: <? if ($_SESSION['newcust']=FALSE){ ?> So, in fact, you are assigning the value FALSE to the session variable. You need two equal signs to perform a comparison: <? if ($_SESSION['newcust']==FALSE){ ?> The...
  4. DRJ478

    Detecting remote downtimes

    Here's another idea: The suggested retrieval of the smallest image still includes data that is transferred in excess of the actual HTTP headers. You can limit the actual request to just the minimum HTTP headers. That way you can tell that the web server is responding and not stress it beyond...
  5. DRJ478

    format search results.

    I had written (a long time ago) a function for highlighting that could be used: /** * FUNCTION highlight * Highlights search terms in an HTML or plain string * * @param $searchwords string The terms that will be split on spaces into individual words * @param $subject string The haystack...
  6. DRJ478

    format search results.

    This can turn into a complicated topic - would you want to highlight the text even if it is a partial match, e.g. if "text" were inside a word like batextender? Anyway, I would recommend to use a PCRE (Perl COmpatible Regular Expression) to handle this. Have a look at preg_replace...
  7. DRJ478

    date format adding days question

    Here's an alternative way: 1. Use the UNIX timestamp and add 60*60*24*2, i.e. 60 seconds * 60 minutes * 24 hours * 2 days 2. And then, this is what you missed, use the date() function to properly format the timestamp for human consumption. You did essentially the right thing, 1152939600...
  8. DRJ478

    Database not selected error

    It must be a specific query that triggers the error and the query is issued via PHP code on a specific line. My recommendation is to add specific indication where the error is triggered from, e.g. adding the line number by using @mysql_query($sql) or die('Error: '.__FILE__.__LINE__.'...
  9. DRJ478

    php mysql variable echo question I guess

    Your hidden field is in the first form. The input elements are only known to the surrounding form tag. Move the hidden tag into the second form and you'll be fine.
  10. DRJ478

    php mysql variable echo question I guess

    You haven't preserved the posted value in any fashion. There are several ways to do that: 1. Use sessions. Store the posted value in a session variable and access it via the $_SESSION superglobal array or 2. Write out HTML, a hidden field which preserves the posted value: echo "<input...
  11. DRJ478

    Using dropdown and mySQL &amp; PHP

    One correction: I truncated the function name for escaping the string: http://www.php.net/mysql_real_escape_string
  12. DRJ478

    Using dropdown and mySQL &amp; PHP

    Here's a suggestion: Name the select elements consistently, e.g. <select name="sel_jobcode"> If you do that you can iterate the $_POST variables and decide by the key to add it to the SQL WHERE clause: foreach ($_POST as $key=>$value){ #check if it's a select, and if not, continue (skip)...
  13. DRJ478

    Using dropdown and mySQL &amp; PHP

    Thanks for providing more info. Do you use context switching (PHP blocks inline with HTML)? All you need then is to call the function in the context where you want to insert the created <select> element: ... Position: <?getdata("e107_act_emps", "position", "title", "title");?> ... Jobcode...
  14. DRJ478

    Send Mail Code, /r /n what does it mean???

    Long texts and HTML like the one in question is a perfect place to use HEREDOC syntax (forget all the escaping): http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
  15. DRJ478

    Database not selected error

    It would be very helpful if you'd povirde the line number on which the error is reported and to point it out in the code. It's just too much code and too little time... How is the article id sent in the URL header?
  16. DRJ478

    Using dropdown and mySQL &amp; PHP

    Think about this: 1. Hopefully - and it is a default setting - register globals is off. 2. Look at the form's method (either get or post). 3. Inspect the superglobal array $_GET (for get requests) or $_POST (for post requests). I assume your form submits the data to itself (look at the action...
  17. DRJ478

    search problems?

    FIrst of all, this is more a SQL question than a PHP question. Anyway, here are some pointers: 1. You have to decide what you want to split on - it appears it is the comma. 2. Have a look at the explode() function in the PHP manual. It will put the search arguments into an array. 3. Iterate...
  18. DRJ478

    php email

    You are talking multi-part MIME mail here. I recommend that you take a look at the PHPMailer class on sourceforge. It allows multi-part mime mail and is the best mail class out there: http://phpmailer.sourceforge.net
  19. DRJ478

    One script wonder?

    Modular development is in my experienmce the best. I also would recommend to write object oriented code rather than function oriented code. The re-use of objects in other parts of the same application or of general objects across applications id of immense benefit. Clean code for the functional...
  20. DRJ478

    Sessions

    A recommendation: Instead of relying on the <meta> tag to refresh the page I would highly recommend to use the server side approach of PHP and user a header("Location: ...") directive. When you use the meta tag you rely on the client side to do the work which in case of authentication is not...

Part and Inventory Search

Back
Top