Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. I would probably start with date_start, and use mktime() to add 1 day until you reach date_end. You can also add 60*60*24 seconds, but apparently that may cause trouble during daylight savings switchovers. Not that I actually understand what happens to time values during DST
  2. Jay2391, I suggest you do some tutorials on arrays.  They are very useful!  And they are ideal for what you want to do here.  Without them, your programming will be limited to very simple things only.
  3. Hi! First, you say you "think" the error is in that line.. the first step is to be sure that the error is in that line.  You should be checking all your queries for errors, and printing out the error message where there is one, using pg_last_error() or pg_result_error(). In this line here: [code=php:0]$sql="SELECT * FROM phones WHERE people = 'Bill’    [/code] the quoting is incorrect.  You should be using ' and not ` or ’ for all your quoting of string values.  For quoting column names you can use ", but I don't think you need that here. Anyway, try checking the error messages as I mentioned above.  That will give you more information to track down the problem. Good luck :)
  4. You can check if the information is already in the database before adding it. If that doesn't answer your question, please provide some more detail so we can help you better :)
  5. You can check if mysql_connect() succeeded or not.  If it returns false, then it failed.  Does your script display an error message if it fails to connect to the mysql database?
  6. I did some more testing with the full code, and it gives totally different results on a 64 bit system.  However it gives the same results on each of the different php versions I tried (4.3.10 & 5.1.4 on 32 bit system, 4.4.2, 5.1.4 and 5.2.0 on 64 bit). The output I got on 64 bit systems was very large (like -8324662986662860468 instead of -781188683), so I'm pretty sure you have 32 bit ints on both your machine and the redhat servers. So that just leaves the different OS.. I would believe that it gives different results on a different OS.  Maybe something in the code depends on a particular feature of that OS, or of PHP compiled on that OS. Hmm.. it looks like it implements an encryption algorithm.  One solution may be to use a library to do the encryption rather than doing it in php.  That would be practical if you can find out what algorithm it is and what inputs it needs.  The mcrypt module might be able to help there. Do you know what encryption algorithm it is? One more question :)  What did you set url to when you got the output in your first post?  And where is that output from?  The first thing it printed out?
  7. The first thing to do is check for errors from your mysql query [code=php:0]mysql_query($createquery) or die("Error in $createquery :" . mysql_error());[/code] Or you may want to add that error to the email notification.
  8. Ouch.  Is it practical to convert it to a subquery including an explicit cast?  That'll get you use of the index.
  9. It's actually 4 tables?  I think we need the full details to solve this.  All four tables, the exact query, as well as a full dump of the output. Edit: I mean the definition of all 4 tables, not the contents :)
  10. Hmm.. well it "looks" like it depends on 32 bit integers.  A 64 bit OS could easily break it.  Can you find out from your hosting provider whether they run a 32 bit or 64 bit version of Red Hat? If they do, then that's very likely the cause.  If not, then back to square one.
  11. My results for versions 4.4.2, 5.1.4 and 5.2.0 on linux match your "working" output. Are you assuming 32-bit or 64-bit integer size in any of that code?
  12. You would use the mail() function. The rest depends on the structure of the data.. if you want more detailed help you will need to post more of your code.
  13. CREATE TABLE uses round brackets "(" not curly brackets "{".  I'm also not sure that you can use numbers for your column names.  Try this: [code=php:0]CREATE TABLE a ( c1 VARCHAR(3), c2 VARCHAR(3), c3 VARCHAR(3), c4 VARCHAR(3), c5 VARCHAR(3), PRIMARY KEY(c1) )[/code]
  14. I'm surprised that the teamids are not unique from that query.  DISTINCT should return unique rows only. To get the structure you want, I would use [code=php:0]$testarr[$date][] = $tid[/code] Then you get the teamids for each date in an array. I'm interested to see what your actual output is from that query.
  15. A) Yes, details are here: http://www.phpfreaks.com/tutorials/61/0.php Normally apache will not be involved in database access, only PHP. B) http://www.mysql.com is the official website.  I'm not sure how best to do the migration. C) Yes it can.  http://httpd.apache.org is the official website.
  16. I would go with the approach of flagging it in the database and having another script try again later.  It's probably the least complex, as you don't have to worry about holding up the user.
  17. Can you post your entire script again, after you fixed the variable names at the start?  That should have fixed things.
  18. Have you tried this: [code=php:0]define('HTTP_SERVER', 'http://' . $_SERVER['HTTP_HOST']); // eg, http://localhost - should not be empty for productive servers[/code] The reason being that HTTP_HOST doesn't include the leading "http://"
  19. This function should help.. you can use it along with date() to format the timestamp nicely. http://sg.php.net/manual/en/function.mktime.php Add the timezone to the hours argument to adjust the time.
  20. btherl

    Groups

    Is this a question about Unix groups?
  21. Normally this would be done with MySQL.  Is that what you are using currently? Can you post the code you have now (if any)?  Otherwise, can you tell us where you are at (eg, still desigining the script) so we can better help you? Thanks!
  22. Can you give some more detail?
  23. The easiest way is to ask the user at registration time. Of course many users will not know what time zone they are in, but they will know what country and area they are in, so it can be better to ask for that than for the time zone. If you want to automatically detect their time zone, look at "geolocation".  That's the word for finding a user's physical location based on their ip address.
  24. For mysql, the search term to use is AUTO_INCREMENT Hope that helps :)
  25. One way to think about joins is that you are looking for matching rows.  In this case, you want to match job_id in jobs with job_id in jobs_employee. The basic statement would be [code=php:0]SELECT * FROM jobs JOIN jobs_employee ON (jobs.job_id = jobs_employee.job_id)[/code] And the result of this will be a list of joined rows, where the employee's data is repeated for each job they work on. Then to restrict it to particular dates, just add a WHERE clauses, such as [code=php:0]WHERE job_date >= '$jobLowDate' AND job_date <= '$jobHighDate'[/code] Then order the results: [code=php:0]ORDER BY job_date[/code]
×
×
  • 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.