Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. I'm thinking that an explanation of what using or anything() actually does might help. Most functions return something that can be treated as either a TRUE or a FALSE value. In the code - somefunction() or anything(); When somefunction() returns a TRUE value, the anything() after the logical or is not evaluated due to short-circuit optimization (TRUE or xxxxx is always TRUE so the evaluation stops at that point.) When somefunction() returns a FALSE value, the or anything() causes the anything() statement to be evaluated/executed. The above is a simple conditional test. However, with an actual if(){}else{} conditional test you have the ability to both specify code that is to be execuited when the condition is true and when it is false.
  2. Yes, but what DOES it return? And as previously mentioned in the thread, what data type is mm_users.user_birthday?
  3. That would result in duplicate/derived data. It would also create a data management problem because a person's age is not fixed (unless they are dead.) You would need to recalculate the age every time you used it in case their birthday date went past. The link I posted above to the mysql manual section shows a query that calculates the age. You can then use the age value in that same query any way you want.
  4. There would be two reasons for that - 1) The data was double-escaped going into the database and now the extra \ needs to be removed, or 2) magic_quotes_runtime is ON and the data is being automatically escaped when it is retrieved from the database.
  5. That's the way it is supposed to be. The \ are only present in the query string so that the special characters don't break the SQL syntax. If you had a case where the \ were present in the database, that would mean that you double-escaped the data.
  6. Both of the errors (a fatal parse error due to the missing dots and an undefined GET array index name due to the mismatch between the name being used on the end of the URL and what the code was using) would have been exposed if you were developing and debugging php code on a system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini.
  7. Because or anything() does not address error recovery (what your code does when an error occurs), blindly continue execution, return a known/default value, output a useful error message and contain with the remainder of the presentation logic on the page, it really should not be used except for debugging purposes. Unless you want to use exceptions, all you really need to do is just use conditional logic so that you can address error recovery when an error occurs - http://www.phpfreaks.com/forums/index.php/topic,280845.msg1330662.html#msg1330662
  8. If you use a string data type to hold numbers and then reference the value as a number it is converted to floating-point or you must cast it back to a number so that comparisons/sorting work, thereby taking up additional processing time on each reference. Edit: Strings are sorted and compared character by character, left-to-right, which means that for example, the string '10' is less than the string '2'
  9. You haven't gotten a solution because your question doesn't contain a definition of what data structure 'this' is. So, far all you have posted are some characters that appear in a post in this Forum, so you have gotten suggestions on how to get the characters to appear like that. Is 'this' a HTML table, an array of arrays, a set of sequentially named variables (please don't say it is), a CSV file (this apparently has been ruled out), an actual EXCEL spreadsheet, or one of several other possible things?
  10. At least two of your column names are reserved keywords and either need to be renamed to something else or require special handling so that they are not treated as keywords and break the SQL syntax of your query - http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html
  11. mysqlnd is just the driver. The actual mysql or mysqli extension still needs to be enabled. Did you place a PHPIniDir setting in your http.conf that points to the php.ini, which should in fact be left in the original directory (you should not be and don't need to be copying files around to different folders.)
  12. Have you checked if the php.ini that you are changing is the one that php is using (its the phpinfo() output Loaded Configuration File line) and did you stop and start the web server to get any changes made to the php.ini to take effect?
  13. Your code needs a WHILE(){} loop to iterate over all the rows in the result set.
  14. I would make an array of the class names, then just assign them in sequence to each <div > - <?php $class_names = array(); $class_names[] = 'color0'; // some unique class name for the first color ... $class_names[] = 'color1'; $class_names[] = 'color2'; $class_names[] = 'color3'; $class_names[] = 'color4'; $class_names[] = 'color5'; $class_names[] = 'color6'; $class_names[] = 'color7'; $class_names[] = 'color8'; $class_names[] = 'color9'; $i =0; for($j =0;$j<20;$j++){ $class = $i++ % 10; echo "<div class='$class_names[$class]'>test</div>\n"; } ?>
  15. You should use the EXTR_PREFIX_ALL 2nd parameter and specify a unique prefix as the 3rd parameter to insure you don't overwrite any existing program variables (someone recently had that happen here in the Forum.)
  16. Use the mysql function timestampdiff with a unit of minute - http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_timestampdiff
  17. Change all the short open tags <? and <?= in your code to full opening tags <?php and <?php echo
  18. You need to fix your table design so that you store dates using the DATE data type. As is, you will be in a loosing battle with every query that attempts to find or sort by your dates.
  19. Except that there are not 356 days in every year and that formula will be off by one day for every leap year the person has been alive (matters to those who's age is being checked close to the day of their birthday.) See the age calculation at this link - http://dev.mysql.com/doc/refman/5.0/en/date-calculations.html (basically take the difference in years, subtract one if the birthday has not occurred yet in the current year.)
  20. Once you have set a cookie, it is out of your hands. The only thing you can do the next time someone visits your site is to either detect the older style information and ignore it or overwrite the older style information with different values/expire time. I would suggest creating a cookie that holds the software version number and if the cookie does not exist or if it does exist but has a version number older than the current version, take appropriate action.
  21. You need to use htmlentities() with the second parameter set to ENT_QUOTES, so that both single and double quotes in the data are converted to html entities so that they don't break the HTML on your page.
  22. You cannot (successfully) program by assuming anything, you must either know or look up, in the documentation, what functions do and what parameters they accept.
  23. This I presume is the code that is outputting the error message you are getting - @imagepng($_FILES[$fieldname]['tmp_name'], $uploadFilename) or error('receiving directory insuffiecient permission', $uploadForm); What does using the imagepng() function (with incorrect parameters as well) have to do with directory permissions? Did you even read the code that is producing the error so that you know the code is what you expect?
  24. That would be the first thing you need to troubleshoot and fix. What IS your browser displaying when you try to register? Do you get the email and does activate.php do what it is supposed to? You cannot worry about login.php working until all the steps leading up to having a valid account are working.
  25. You didn't post anything that shows the GROUP BY that you used. Best guess is that you did a GROUP BY something that would cause the output to be what you posted instead of what you wanted.
×
×
  • 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.