Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. Php code in a .php file cannot be seen outside of the actual file on the server. HTTP requests for the file only result in any output from that file. Unless you echo your password in your php code or php no longer works, it is safe to put passwords in a .php file as php code. Making a HTTP request for the file simply wastes server resources serving up a .php file that doesn't output anything. If you do put your included files inside the document root folder (i.e. for server setups where you cannot put files outside of the document root folder), you typically put all of them into a common folder and then use a .htaccess file to prevent all HTTP requests for the files in that folder.
  2. The forum's menu button you used to highlight your php code is for making links to the php manual section for php keywords. Just use the forum's bbcode tags for php code. $HTTP_POST_FILES was depreciated a really long time ago, turned off by default in php5.0, finally throws a depreciated error in php5.3, and is completely removed in php5.4. Use $_FILES instead of $HTTP_POST_FILES
  3. Text areas don't have value='' attributes. The text goes in between the opening and closing tag - <textarea>content gets echoed here...</textarea>
  4. Examples can be found posted all over the Internet. Search for - javascript calculate form fields
  5. You are getting blank emails because your form processing code is not testing if a form has been submitted at all and it will send an email every time the page is requested (when there is no submitted $_POST data, for your first posted code, because it at least was testing the submitted data.) This will occur every time a search engine indexes your site or a spam bot script requests your form processing page. At a minimum, you must do the following - <?php if($_SERVER['REQUEST_METHOD'] == "POST"){ // all your form processing code goes in here, including the mail() statement. } ?> You also need to validate ALL the external data before using it.
  6. I recommend that you play computer and proofread your code and comments in your code to see if it is logically doing what you expect.
  7. The comment above each function doesn't match what the code is doing in each function, which also results in the wrong array element number being accessed by the code in each function.
  8. Best guess is that in the code that is before the code you did post, you are fetching and discarding the first row from the result set. Posting all the code from the query through to the end of your loop is the best way of getting the quickest solution. The code you did post is also producing errors on the last pass through the loop because of the equal comparison in the loop condition (and that you are starting the loop at zero.) You should only be using less-than < You should also have php's error_reporting set to E_ALL and display_errors set to ON so that php will help you by reporting and displaying all the errors it detects.
  9. Ummm. That's not equivalent to the logic that was given.
  10. $_SERVER['DOCUMENT_ROOT'] will give you the absolute file system path to your document root folder (kind of why they named it what they did.) You can then append (concatenate) your path/filename.ext on to that to produce an absolute file system path that will work regardless of which file actually includes your file. If that doesn't accomplish what you want, you can use the include_path setting to get php to search for your include files in specific folders.
  11. A leading slash on a link/URL refers to the root of the domain (i.e. a domain relative link/URL.) All the URL's you have shown in your post are trying to find the file starting at your domain root - http://yourdomain.com/images/picture.jpg http://yourdomain.com/dir1/dir2/images/picture.jpg Relative URL's either start with a dot or double-dot or are just the filename.
  12. If you want help with some specific code you tried, you would need to post it along with some sample data. Also, state what didn't work when you tried it.
  13. The assignment operator is one = sign. The equal comparison operator is two == signs. If you are trying to assign a value to a variable, you use one = sign.
  14. You would use GROUP BY Season
  15. Someone (me) posted a link to a thread showing how to do that (you remember the title and output a new heading when the title changes.) An equal comparison is two == (an assignment is one = sign) You have an if() statement using one = sign, instead of two ==. What format is your startDateTime value?
  16. A negative number in the LIMIT clause is invalid. $page is either empty, non-existent, or a zero. You must always validate/limit data that you put into query statements.
  17. You should NOT have a separate page for each different category/product type, where the only thing that changes is the actual data you are operating on. You are making more work for yourself and by having so much duplicated code spread out in several pages you cannot see the forest for the trees to add on one more category. What you need to do is have one page that accepts a ?category=x (x=1,2,3,...) get parameter on the end of the URL that tells the code on that single page what the page should do. Edit: You also mentioned CSV several time. There's nothing in your hundred's and hundred's of lines of code having anything to do with a CSV data (that I can see - i.e. the forest for the trees problem.)
  18. benchew0904, whomever assigned this, probably wanted you to send the reminder email once, a specific number of days ahead of when the appointment is scheduled? Also, your appointment_date column needs to be a mysql DATE data type so that you can perform the date check in the query. The 24/12/2011 format cannot be directly used by mysql. Edit: Also, if for some reason your code doesn't send out a reminder at the intended time (your code didn't run for some reason, email could not be sent for some reason, ...), what do you want to do? Keep trying and for how long?
  19. Cannot help you without the code that is responsible for the symptom. Someone already posted the three possible types of URL's to use. It is up to you to make sure that each element in the type of URL that you are using is correct. Usually, the path to the image is incorrect.
  20. http://dev.mysql.com/doc/refman/5.5/en/example-maximum-column-group-row.html
  21. array_diff
  22. If you search for (the keywords in) that error message, you will find that it generally means that your query failed due to an error of some kind. There are a couple of other possibilities, depending in what your actual code is (it always pays to post enough of your actual code the reproduces the problem.) For debugging purposes, use the following for your mysql_query statement - $rsd = mysql_query($sql) or die("Query failed: $sql<br />Error: " . mysql_error());
  23. There are multi-byte string functions - http://us3.php.net/manual/en/ref.mbstring.php
  24. No. The first one tests if there were any rows returned by the query, which also indirectly detects that the query executed without any errors. The second one only tests if the query executed without any errors. There can still be zero rows in the result set at your // do something point in the code.
×
×
  • 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.