Jump to content

scootstah

Staff Alumni
  • Posts

    3,858
  • Joined

  • Last visited

  • Days Won

    29

Everything posted by scootstah

  1. Huh, that's odd. I'm not sure what would cause it to do that.
  2. And those dates are not the same in the database? What does this give you: $result = mysql_query("SELECT a_datetime FROM forum_answer WHERE question_id='$id'"); echo '<pre>'; while($row = mysql_fetch_assoc($result)) { print_r($row); } echo '</pre>';
  3. $result = mysql_query("SELECT DATE_FORMAT(a_datetime,'%a %b %d, %Y %l:%i %p') AS a_datetime FROM forum_answer WHERE question_id='$id'"); echo '<pre>'; while($row = mysql_fetch_assoc($result)) { print_r($row); } echo '</pre>'; Can you run this code, exactly like that, for me? Post the output in your next reply.
  4. <div class='view_post'> <div class='view_post_date'> <p>Published: <?php echo $a_datetime;?></p> </div> <div class='view_post_user'> <p> Username: <?php echo $a_username;?> <br /> Post Count: <?php echo $a_post_count_1; ?> <br /> </p> </div> <div class='view_post_content'> <p><?php echo $a_answer;?></p> </div> </div> Is this code inside the while loop? I can't really tell, because I don't see any closing brackets.
  5. Then why did you mark it as solved? $result = mysql_query("SELECT UNIX_TIMESTAMP(date_time) AS date_time FROM table"); $row = mysql_fetch_assoc($result); echo $row['date_time']; // YYYY-MM-DD hh:mm:ss $result = mysql_query("SELECT DATE_FORMAT(date_time, '%a %b %e, %Y %l:%i %p') AS date_time FROM table"); $row = mysql_fetch_assoc($result); echo $row['date_time']; // Sat Aug 11, 2012 1:01 AM
  6. Just a heads up, you don't have to do this: $date = strtotime($date);. In the query, you can use the UNIX_TIMESTAMP() function to return a timestamp instead of the date/time string. You can also use the DATE_FORMAT.
  7. And ini_set('display_errors', 1);
  8. What do you get when you run this in your script? var_dump(is_writable('log.txt'));
  9. The concept is pretty simple - just parse the user input and look for a command, then execute the appropriate action.
  10. You could bang this out very quickly if you use a CMS. I'm sure there is some module for Drupal that is very close to your requirements.
  11. If you are storing the date in a DATETIME column (which you should be), you can simply use the NOW() MySQL function to insert the current date/time in a proper format. INSERT INTO table (date) VALUES (NOW());
  12. Use bcrypt or PBKDF2. There is plenty of libraries available for the implementation of both, such as PHPass or phpseclib.
  13. Do you think referencing columns with arbitrary numerical indexes is a better solution?
  14. Use aliasing to change the name of the index. $query = "SELECT `cities`.`Name`AS city_name ,`countries`.`Name`AS country_name FROM `cities` LEFT JOIN `countries` ON `cities`.`CountryCode` = `countries`.`Code` WHERE `cities`.`ID` = 10"; EDIT: Also, if you know that data will be pulled from two tables like this then it is best to prefix the columns in the database ahead of time, to avoid confusion.
  15. lol, 370*C on that AMD Athlon. Holy shit.
  16. Except your code is now, again, vulnerable to SQL injection and will probably not work if all of the expected data doesn't exist (like the post_id).
  17. You can use gmdate if you don't want to take the timezone into consideration.
  18. This seems like the best, and easiest way to go. If you don't want to (or for some reason can't) use SSL, you will have to encrypt the data manually. Both ends of the connection will have to know how to encrypt/decrypt the data.
  19. Remove the @ in front of mysql_query(). Suppressing errors isn't a good thing to do, and mysql_query() doesn't output anything if a query fails. Also, remove the or die(mysql_error())'s when you go to production. In production you should be logging the errors, not displaying them to the public - especially SQL errors. All the user has to know is that something went wrong. Maybe send a "500 - Internal Server Error" header or something.
  20. Those are called HTML entities. They are basically encoded characters. is a "non-breaking space". You can decode them with html_entity_decode. If you want to remove them entirely you're going to need use a regular expression.
  21. <?php date_default_timezone_set('America/Los_Angeles'); $month = date("F Y"); $day = date("d"); $year = date("Y"); $date = date("Y-m-d");
  22. Is that CPU or GPU? GPU wouldn't be a problem, but CPU might...
  23. The problem was his ternary statements. $post_id = isset($_POST['post_id']) $_POST['post_id'] : ''; $title = isset($_POST['title']) mysql_real_escape_string($_POST['title']) : ''; $content = isset($_POST['content']) mysql_real_escape_string($_POST['content']) : '';
  24. You really need to turn on error reporting.
  25. While interesting, that doesn't really prove that Javascript is enabled/disabled. You can have Javascript enabled but cookies disabled, and it will never work.
×
×
  • 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.