Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. This topic has been moved to Third Party PHP Scripts. http://forums.phpfreaks.com/index.php?topic=364326.0
  2. Because each actual image is static, you can get a 'signature' for them (filename, filesize, and/or actual binary data of the image) that lets you map the question to the correct image. You would need to dynamically alter the images each time they are output, varying the size/color/name... so that any one actual image has a random signature each time it is used.
  3. Your emailactivated column apparently has a unique key or similar defined for it, meaning you can only have one row with a '1' in it at any one time. You would need to remove the unique restriction from that column.
  4. The problem is due to conversion of the number to binary. Some fractional numbers cannot be represented exactly as a binary number and you end up with a loss of precision. To avoid this conversion error, you need to store and operate on the numbers as BCD (binary code decimals), the same as what a calculator does. See the following bc math extension - http://php.net/manual/en/book.bc.php
  5. I'm going to guess that your UPDATE query is failing. You don't have any error checking/error reporting logic in your code to get it (your code) to tell you if and why a query might be failing. For debugging purposes, use var_dump($sql); right after the line with the UPDATE query and see what value the mysql_query statement returned. If it returned a FALSE value, use mysql_error to find out why the UPDATE query is failing.
  6. ereg_replace is depreciated. You should be using preg_replace instead.
  7. What exact symptom or output do you get on the activation page? And if you get a blank page, what does a 'view source' of that page in your browser show? Edit: Also, does the URL in the email message have the expected id value on the end of it?
  8. The DOC for that 'parser' indicates it just wants an expression that produces an assignable value. The code probably does use eval internally to accomplish that, but that is not directly an issue. The OP is apparently testing using eval, but since the {item.xxx} is the parser's syntax to indicate data values and is not valid php, directly using eval should produce an error. I'm going to guess the following might work - {{date('Y-m-d H:i:s', strtotime(str_replace('/','-',{item.StartDate})))}}
  9. I would go the str_replace route to get strtotime to work with that format - $dateStr = str_replace('/','-',$dateStr);
  10. Are you sure your column isn't a Mysql TIMESTAMP data type?
  11. Your code is not using the $i variable when you have it inside of a single-quoted string, because php variables are only replaced with their value inside of a string when the string is using double-quotes. You should also always use full opening <?php tags, since the short opening tag <? are not always enabled and you might not have the ability to enable it on any particular server.
  12. Both the error message and the work-around that you used to stop the error indicate that you are including the file twice.
  13. What does the 'view source' of the blank page show? What exact URL are you entering in your browser for that page?
  14. Since you are using a prepared statement, in general, you would need to do it the way you came up with. I would form an array with keys/values and do this all in one simple statement - $myarray[] = array('name'=>$name,'address'=>$address,'town'=>$town);. If you have php5.3+ and are using the mysqlnd driver, you can convert the result from a prepared statement into a mysqli result set using - http://php.net/manual/en/mysqli-stmt.get-result.php This will allow you to use traditional mysqli fetch statements to iterate over the result set.
  15. You are either including the file twice or you are including it inside of a loop. Also, don't use the global keyword (ever.) Using it outside of a function doesn't do anything, except to waste processing time. Using it inside of a function for your connection variable makes your code is hard-coded to only be able to use that one connection. You should pass variables into a function as a call-time parameter and return any result from your function to the calling code, to make your function general purpose.
  16. This topic has been moved to Application Frameworks. http://forums.phpfreaks.com/index.php?topic=364215.0
  17. The right direction to take would be to put back in the update logic you had and to find and fix what was causing the error in it.
  18. I recommend a rewrite as well. The posted code is apparently processing a form submission. However, it has no logic to test if a form was even submitted; it is not validating any of the submitted data (the code shouldn't even get to the point of executing the query when the $studentid is empty); and it is not doing anything to prevent sql injection/query errors due to unexpected/hacked data values.
  19. This topic has been moved to PHP Freelancing. http://forums.phpfreaks.com/index.php?topic=364222.0
  20. The form processing code that was posted should not be used, ever. Not only does it not address how to process the array of multiple uploaded files, it is derived from the w3schools site and since it tests for upload errors AFTER it has tried to use the uploaded file information, it will never correctly report upload errors. See example #3 at the following link for how you would loop over the resulting array of uploaded files, testing for upload errors first, then only using the uploaded file information when there were not any upload errors - http://us.php.net/manual/en/features.file-upload.post-method.php You would insert your validation logic right before the move_uploaded_file statement in the php.net example code.
  21. The code was also producing that error on the server, but the error was being hidden by the error_reporting/display_errors settings. Php was still detecting that problem every time the code runs, but it was not being reported and/or displayed and if php was actually logging the error to the error log file, you are gradually building a humongous error log that makes it difficult to find actual errors that might be occurring when your code runs. All code should not produce any kind of errors during its normal execution. Only for abnormal things, such as a legitimate visitor feeding your script unexpected values that you didn't take into account or a hacker trying to break into your script, so that you can find and fix actual problems. Unless you are trying to develop a general purpose script that would work on a minimum php/mysql version, your development system should have the same version of php/mysql as your live server so that you don't waste time making changed just due to the version differences.
  22. You can use a FIELD() statement in a query to produce any custom ORDER BY term - ORDER BY FIELD(your_column, 2,3,1)
  23. The error is because you are calling a mysql_query statement a second time with a variable as the first parameter (the query statement) that does not exist.
  24. Then the most likely cause is - What's your code that is forming the SELECT query through to the point where you are executing the insert query? Do you have error checking logic in your code to detect and report when a query fails? What approximate quantity of queries are you executing and are they enough to account for the number of auto-increment values that are used/skipped? 10s, 100s, 1000s? It's also possible that your code is being requested multiple times by the browser and/or you have code that is inserting, then deleting rows, thereby using up auto-increment values. Do you have any header redirect statements that don't have exit/die statements after them to prevent the remainder of your code from running while the browser requests the target of the redirect? You could be failing to stop the execution of your php code and it goes on to delete rows that were just inserted. The short answer is, there are multiple things that could be causing such a symptom and to either confirm or eliminate the code, the most common cause of unexplained computer behavior, as the cause, it takes seeing all the code that reproduces the symptom.
  25. The times I have seen an auto-increment field 'skip' values is when an insert query either produces an error or you have a query that intentionally ignores errors. The query still gets the next available auto-increment value, but does not use it. Any chance your code is intentionally setting the auto-increment value in a query and you have a logic error that is causing this or perhaps you are mass inserting data that already exists and the insert query is getting auto-increment values but not using them (the next successful insert would use the next available one and would appear to skip values) or perhaps a hacker has been feeding your script data values that cause the query to fail and get/use up auto-increment values.
×
×
  • 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.