Jump to content

cyberRobot

Moderators
  • Posts

    3,145
  • Joined

  • Last visited

  • Days Won

    37

Everything posted by cyberRobot

  1. You could use getElementsByTagName() to get the table and then all the columns for the table. More information can be found here: https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByTagName Then you could loop through the columns, rebuild the table, and replace the old table with the new one.
  2. You could add a query that checks if the hashtag exists already. For the hashtags that exist, you would skip the insert query.
  3. The longest month ever
  4. Yep, I'm sure the tool would have been handy when I spent more time taking screenshots. For what it's worth, the tool is still available on Windows 10, but the name changed to Steps Recorder.
  5. Alternate solution: <?php $y = date('Y'); $yearRange = range($y+1, $y-11); foreach($yearRange as $currYear) { echo '<option value="' . $currYear . '">' . $currYear . '</option>' . "\n"; } ?>
  6. What does the code for creating the <option> tags look like?
  7. With each line split into an array, you could loop through the array looking for the start point. Then store each of the following lines in a separate variable until the stop point is reached. Yep, that would be problematic.
  8. You could use the strpos() function to locate the two strings. And then use substr() to get the content between the two points.
  9. In addition to Psycho's code, you can use the lvl1-4-5 class to add a default color. <style type="text/css"> .lvl1-4-5 { background-color: #FF95FF; } .brandHonda { background-color: #FFD9D5; } /* ... */ </style>
  10. My preference is to list the common name first. So something like "LoginAttemptsLog-SQL", "LoginAttemptsLog-MongoDB", etc. That way if all your include files are stored in the same directory, the login attempt classes are grouped together when the files are sorted alphabetically.
  11. What does $departure_date->format('j M Y') output?
  12. What does the code echo now? Have you tried outputting the various variables to see if you are getting expected values?
  13. Note that the original post was made in June 2014. The OP also hasn't been back since August 2014. I locked the topic to prevent it from being resurrected a third time.
  14. Sorry, I meant array_fill_keys(). And it would only replace the part where you initialize $defaults. Here's a quick example: <?php $defaults = array_fill_keys(array('first_name', 'last_name', 'username', 'password'), NULL); print '<pre>' . print_r($defaults, true) . '</pre>'; ?>
  15. If you are initializing a lot of variables with the same value, you could consider using array_fill(). More information can be found here: http://php.net/manual/en/function.array-fill.php Wrong function. See the post below.
  16. Just to clarify, that was to replace step 1 of Psycho's solution. You should be able to use array_chunk() next, etc. https://forums.phpfreaks.com/topic/302791-i-have-an-array-that-i-need-to-get-into-a-db/?do=findComment&comment=1540606 Would there ever be a case where it uses "\r\n" instead of just "\n"? I honestly don't know.
  17. Have you tried preg_split() and the white-space character (\s) for the pattern? Here is an example found through the Google link provided earlier: $oparray = preg_split('/\s+/', trim($output));
  18. MySQL has built in date functions. More information can be found here: https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html Also note the first example that uses INTERVAL Side note: In case you are not aware, the mysql_* functions were removed in PHP 7.0. More information can be found here: http://php.net/manual/en/mysqlinfo.api.choosing.php
  19. Yeah, sorry about that. I only "quoted" you to refer to the unnecessary function. As soon as I hit post, I realized that wasn't the best way...but was in too much of a rush to correct it. I figured it would be better to ask for forgiveness. Edit: I removed the quote since it was misleading and unnecessary. Yep
  20. You should use mysqli_connect() to select the database. More information can be found here: http://php.net/manual/en/function.mysqli-connect.php Note: the documentation recommends that you only use mysqli_select_db() to change the default database. More information can be found here: http://php.net/manual/en/mysqli.select-db.php
  21. Searching Google, the solution seems to come down to using explode() or preg_split() to break the string based on the white-space character. https://www.google.com/search?q=php%20get%20an%20array%20from%20shell_exec
  22. For what it's worth, shell_exec() returns the output as a string. More information can be found here: http://php.net/manual/en/function.shell-exec.php
  23. endforeach is the alternate syntax. More information can be found here: http://php.net/manual/en/control-structures.alternative-syntax.php
  24. With the effort he puts into his responses and the depth of knowledge he shows on a regular basis, I'm somewhat surprised he only has 1000. Congrats Barand!
  25. That...and $montharray is a property of a class. So you would need to use $this->montharray to get the value.
×
×
  • 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.