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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by DRJ478

  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?

Part and Inventory Search

Back
Top