Jump to content

fastsol

Moderators
  • Posts

    827
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by fastsol

  1. Is there a way via php script to sync a servers time? I have a dedicated server on a webhost and I can go in a sync it manually, but I would really rather not have to remember to do that every so often. I have read that a NTP can be setup, but I have zero knowledge of doing command line stuff like all the examples show to do. I was hoping for a php version of code that could accomplish the same thing. The reason I need to make sure it's synced is I ran into an issue with a Google API last night that stopped allowing me to authorize cause the time Google saw was not within range of what it wanted. Once I synced the server time, it let me authorize with the API. I don't want my website to break periodically if I forget to sync the time, so an automatic sync would certainly be best.
  2. If it takes 1.87 seconds to complete a 2 row result, that's terrible. Just think how long that would take with 100 or 1000 rows.
  3. Ok so then this table is actually not needed and will only make life harder in the future. What you need is 2 reference tables to go between the users table and the hair color and body type tables. Since ethnicity should really only have one value to a user, there shouldn't be any reason to store more than a single value per user. So the reference tables have only 2 columns, the user id and the id or the hair color or id of the body type. Then you use JOIN to gather the info from all the tables by referencing the ids between them. table name -> body_types_reference +---------+-----------+ | user_id | body_types| +---------+-----------+ | 1 | 1 | | 2 | 1 | | 2 | 5 | | 2 | 9 | | 1 | 5 | +---------+-----------+
  4. Here's a post with lots of examples http://stackoverflow.com/questions/5773405/calculate-age-in-mysql-innodb
  5. You're going to need to change the data type of the dob column to an actual date format or you won't be able to determine any kind of time difference from it's values.
  6. Here is an example query to try. I have not tested this example and it is strictly built off of examples I found googling. If this doesn't work, google this sum multiple columns in a row mysql UPDATE `table` SET `average` = ((value1 + value2 + value3 + value4 + value5) / 5)
  7. Use the css border-radius. There are tons and tons of tutorials and info out there about it.
  8. It's a little confusing as to if you want this done with or without user input. Meaning do you want the server to perform this task on it's own at certain times during the day/month/year/etc, OR is a client viewing the site supposed to view this page and have the value generated for them? The first method you would use a cron job, which you can setup to run when ever you want and does not require a client to visit the page to run the code cause the server runs it itself.
  9. Displaying the numbers before the actual end time would only confuse the clients viewing it beforehand, especially since the shown numbers have no content value to them what so ever. As stated, it doesn't prove any kind of trust.
  10. I put results in a session for my product list. I also put the query string in a session var. The query string would change based on different vehicle selections by the client. So I just check if the query string is different from the one in the session and only run the query if it is different. In todays web market with so many users on mobile devices, it's really best to minimize load time in any logical method you can, this method is certainly one of those methods.
  11. Most likely it's cause you are dividing a string value ($num_rows) by a integer value ($columns). Assuming that $_GET['member'] is always supposed to be a full integer value, do this. $display = (int)$_GET['member'];
  12. Using a php library like phpmailer would make this a null subject cause it will automatically build all that for you, plus helps in delivery since it builds all the needed parts automatically.
  13. There isn't really any reason to do as much validating as you are on the first line of $page. You could shorten it to this and still come out with the same result. $page = (!empty($_GET["page"])) ? (int)$_GET["page"] : 1; Also, when type casting to number formats, there is no reason to use some thing like htmlentities() on the var too. The type cast will strip anything that is not valid for the number formatting you are casting to.
  14. You can certainly call jquery in the manner you are. BUT it must be called BEFORE your plugin.
  15. echo '<tr><td><input type="checkbox" name="'.$data['name'].'" value='.$data['value'].'></td></tr>'; When echoing html, I find it best to use 'single quotes' to encase the string. That way you don't have to escape the double quotes in the html to concatenate the php vars in the string. This way also makes the vars stand out in the code o you can see them better.
×
×
  • 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.