Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. Your code has no error checking and error reporting/logging logic in it, so you will never know if a query error is occurring or not. Your code also has no indentation, making it hard for you, or anyone who might help you, see what the logic is doing. You are also using variable names, such as $sql2000000, that are error prone and reduce the chance of someone trying to help you with code that has more than one or two variables in it named like that. Use names that indicate the purpose of the variable. That's also an update query, not an insert query. What exactly are you trying to do, insert a row or update an existing row?
  2. Back to the code in the first post in this thread. Don't define your $months array inside your loop. Put it before the start of the while(){} loop. You can get the month name by simply referencing: $months[$rma_month_issued - 1]
  3. ^^^ Not.
  4. In addition to the mysql DATE_FORMAT() function, look into the mysql MONTHNAME() function.
  5. I recommend that you read the upload section of the php.net documentation - http://us2.php.net/manual/en/features.file-upload.php
  6. The variables you are assigning the form data to in your code ($BuyerSeller, $Make, ...) are not the variables you are putting into the query statement. You are putting the original $_POST variables into the query statement.
  7. It's likely that the O'Reilly code is correct, but as stated in this thread, the ending heredoc tag in the code you posted does not start in column 1. Ref: http://us3.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
  8. If the image name IS based on the auto-increment id, you don't need a separate column to hold the image name. The existing id column already contains the information you need.
  9. The $end error occurs anytime php reaches the end of your file while it is still expecting some php syntax. This can happen for any un-closed php syntax, including a string that is not closed. In your case, it is because the heredoc string is not closed because the ending heredoc tag must start in column 1.
  10. ^^^ Actually, you wouldn't want the id to appear in the SET term at all as it is the key value you are using to identify the data in the database table.
  11. strtotime uses the current date/time for the fields that you don't explicitly list (it produces a unix timestamp by internally calling the mktime() function that includes the year, month, day, hour, minute, and second, even if you don't supply a value for each of those fields.) Since you haven't listed the day, it uses the current day (29,30,31) and the symptom you are having somewhere (the link you posted worked for me as well) shows up when the current day doesn't exist in a month that you happen to be cycling through (Feb only had 28 days this year.) Use the 01 first day of the month in your strtotime statement "2011-02-01". Also, you should almost never (by no means, not the least bit) ever put a query inside of a loop so that you execute it 30 times on a page to build a calendar. In fact that's likely why your page renders noticeably slow when you switch months. You should execute ONE query that gets all the rows you want (get all the rows for the selected year/month), in the order that you want them (order by classDate), then simply access the correct row(s) inside the loop as you iterate through the days in the month.
  12. What does a 'view source' in your chrome/ff browsers of the blank page show?
  13. The SET keyword is only use once in an update query statement.
  14. I suspect that the existing file is locked by some other process (i.e. the permissions are correct, but you are getting a permission error because you cannot write to it because it is locked.) If any other possible process that could have opened the file for writing has been terminated, you should be able to clear the write lock (since I don't know anything about the operating system you are using, that is the limit of what I can do to help, should this be the actual cause of the problem.) Have you tried deleting the existing file and/or trying with a different file name?
  15. The first line you tried is correct in that it inserts a \n into the HTML source code. If you are trying to get a new-line to be rendered in the browser, you need to use a <br /> tag. See this function to get php to do this for you - nl2br
  16. Literal date values (your $thisdate value) inside a query need to be enclosed in single-quotes. Your query should end up looking like - SELECT * FROM your_table WHERE substring(confirm_time,1,10) = '2011-05-29' Your substring() code will work, but using the mysql DATE() function is probably the fastest method - SELECT * FROM your_table WHERE DATE(confirm_time) = '2011-05-29' If the $thisdate value you picked to show is intended to be the current date - SELECT * FROM your_table WHERE DATE(confirm_time) = CURDATE()
  17. Use the following two lines to set error_reporting and display_errors - ini_set("display_errors", "1"); error_reporting(-1);
  18. You should be able to directly get strtotime to use GMT - $postedTime=strtotime($comment_from_db->date_posted . ' GMT');
  19. What does echoing $comment_from_db->date_posted show? What does echo date('Y-m-d H:i:s') show? And, strtotime() takes into account the current time zone setting, whereas time() does not, so you might have an extra hour or two (or four) being used in the math.
  20. Quotes inside of a string need to be escaped (when they are the same type of quote that starts/ends the string.) The quotes that start and end the string aren't escaped. In your last post above, the escaped double-quotes are inside of a double-quoted string. In your previous post where you asked about this, you don't have any quotes inside any of the double-quoted strings.
  21. There are a few things that could prevent your query from working - 1) The $id variable either doesn't have any value (this would produce a query error) or it doesn't have a value that matches any row in your table (this would result in a query that affects zero rows), 2) One or more of the variables contains special sql characters and needs to be escaped (this would produce a query error), 3) The $Stat value is a non-numeric value and needs to be enclosed in single-quotes (this would produce a query error.) Have you echoed the $q variable so that you can see what it actually contains? Are you testing the value that mysql_query() returns somewhere so that you know if the query executed without or with an error? If the query executes without any errors, are you using mysql_affected_rows to find out if the query did or didn't update the row?
  22. 2. - cannot help you with your code or any errors without seeing the code and the error. The code you just posted, where you are executing the same query, but for different id values inside of a loop, is not using different table names, and so does not demonstrate what you state you are trying to do. However, you should only execute ONE query that gets all the rows you want in the order that you want them, and then simply output the information the way you want it when you iterate over the rows that the single query returned. Php function names are not cases-sensitive, isSet is isset
  23. $result = mysql_query("SELECT * FROM {$Trow['NameOfTable']} WHERE id = $counter"); However, you need to rethink your design. You should NOT make a new table for each different piece of data, where you must execute one query JUST to get the table name that you are going to actually query.
  24. What's to reinvent? You need to multiply by 100 to get percent. Don't over complicate things just because you are using a computer to do them.
  25. Does the URL in the <img src="..." have a $advertid value on it? Assuming that you already have php's error_reporting set to E_ALL and display_errors set to ON, temporarily comment out the header() statement in advertimage.php and browse directly to advertimage.php?id=some_valid_id_here and see what you get as output.
×
×
  • 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.