ManiacDan
Staff Alumni-
Posts
2,604 -
Joined
-
Last visited
-
Days Won
10
Everything posted by ManiacDan
-
12/31/1969 is the date you get when you pass an invalid argument to date-processing functions. $approved_date doesn't exist in this code block. Perhaps it's set somewhere else? This is the perfect case for a basic debug lesson: You have a problem with your date. Your date function accepts one argument. Look at that argument. Figure out why it's wrong.
-
Dual language support: right to left, and left to right
ManiacDan replied to YigalB's topic in PHP Coding Help
Right, that was an example. You do it on a "per text element" basis. "Hello!" is one. "This website copyright © 2012 by Some Guy International, all rights reserved" is another. -
I've found a number of bugs in firebug, ironically. Mostly related to tracking the response from ajax calls. I still really like it, but chrome developer tools is roughly the same for the work I need to do.
-
No, that's what we're saying. MD5 is not secure for storing passwords. You should use the crypt function with a salt.
-
Dual language support: right to left, and left to right
ManiacDan replied to YigalB's topic in PHP Coding Help
What you need to do is wrap EVERY word in a "translate" function. For every piece of text on your website, instead of echoing it directly, echo tl("Hello!"); Then make a translation file that maps "Hello!" To "Hola!" And "Bonjour!" tr() will echo the proper one based on your language. -
$sqlstring = "SELECT * FROM town_coords WHERE town_name LIKE '%{$airport}%'"; -Dan
-
$DB->query("SELECT SUM(IF ( from_id = {$ibforums->member['id']}, amount, 0 ) ) fromSum, SUM(IF ( to_id = {$ibforums->member['id']}, amount, 0 ) ) toSum FROM gold_logs WHERE from_id = {$ibforums->member['id']} OR to_id = {$ibforums->member['id']} "); $data = $DB->fetch_row(); $from = $data['fromSum']; $to = $data['toSum']; -Dan
-
Dual language support: right to left, and left to right
ManiacDan replied to YigalB's topic in PHP Coding Help
You can set text direction in CSS, just make sure every span has a "directionable" class, then change that one line in your CSS. -
Don't print the error on a separate page. Post to the SAME page, and print the error at the top of the page. Then use your existing code in your second block to retain the form data when necessary.
-
AK: Yes, really. Time is incredibly complex in programming, and if you don't realize that there are things like leap seconds, leap days, and daylight savings you'll end up with "bugs" that you can't explain. Scoot: No. According to wikipedia and the screenshot of time.gov, there was a leap second at 2008-12-31 18:59:60 in EST. Adding 1 seconds to 2008-12-31 18:59:59 should give you 2008-12-31 19:00:00 but it does not: php > echo date('c', strtotime('2008-12-31 18:59:59 + 2 seconds')); 2008-12-31T19:00:01-05:00 PHP also doesn't correctly account for the leap second in the difference between the times: php > echo strtotime('2009-01-01 00:00:00') - strtotime('2008-12-31 00:00:00'); 86400 Although it's moot since the DateTime library doesn't respect the leap second either: php > $a = new DateTime('2009-01-01 00:00:00 EST'); php > $b = new DateTime('2008-12-31 00:00:00 EST'); php > $c = $a->diff($b); php > echo $c->format('%d days, %h hours, %m minutes, %s seconds'); 1 days, 0 hours, 0 minutes, 0 seconds What you really have to know is that computer scientists didn't have anything to do with writing the calendar. The exact size of a day, month, and year change (and the number of days in a week have been altered legislatively, but not in the last 300 years). You can be relatively certain that assuming there are 86400 seconds in a day, but you need to know it's not exactly right. The reason I posted in the first place is because the OP thought 30 days from a date in February was the same day of the month in March. It's not. There are 4 values for "length of a month in days" and unfortunately two values for "length of a day," even though the leap second isn't really all that important. -Dan
-
It's not. That was my point.
-
A day is never 145440 seconds, it is 86400 seconds. That's what I get for posting before I have my coffee. Where did that number come from? Seriously.
-
PHP MySQL Stored Procedure Getting Number of Rows Returned
ManiacDan replied to jonatec's topic in PHP Coding Help
Please don't post the same question to multiple websites, you're wasting the time of the communities if they have to answer twice. The existing discussion is already in progress on DevShed Also, don't use attachments in the future, use [ PHP ] and [ /PHP ] tags (no spaces) to highlight your code. -Dan -
Also note that 30 days from today is 3/2/12. A day is not always 145440 86400 seconds, a month is not always 30 days, a year is not always 365 days, etc. Use the dateTime::dateAdd() function if you have PHP 5.3 or above.
-
$sql = "INSERT INTO someTable ( someDateField ) VALUES ( '" . mysql_real_escape_string( $_GET['gd'] . '-' . $_GET['mj'] . '-' . $_GET['dan'] ) . "' )"; -Dan
-
I believe the questions are designed to show you how easy it is to find simple information on google, so you don't ask us to do it for you. Also, to address something in your first post: Creating a timestamp field with the default value CURRENT_TIMESTAMP. The function NOW() is used to return the current timestamp inside queries, but CURRENT_TIMESTAMP is the mysql command for defaults. See the manual for more. -Dan
-
It should have always generated a warning, it's poorly written. You may have enabled errors or upgraded your server or whatever to generate the error. All strings need to be quoted, or you'll get an undefined constant error.
-
the 's' should be in quotes, yes. % is the modulous operator This line basically says "only execute the following code on even-numbered seconds." I don't know why they'd want that. I also don't know why they used 's' instead of the more correct 'U'
-
I don't know, I don't use creative suite.
-
You've set up CreativeSuite incorrectly and have not even started using PHP. The CreativeSuite documentation, help files, or forums would be best.
-
Seriously, if you want the help of experts for free, try to answer all the questions. You claim you have errors. Actually seeing the errors is the only way we can help you. Errors, show them.
-
Again, basic statistics have nothing to do with PHP. You want to study basic probability. The probability of the first number being 1 is 1/4. The probability of the second number being 1 is also 1/4. You multiply the odds together to get your answer: 1/4 x 1/4 = 1/16, or 6.25%
-
Neither is refusing to respond to "did you change your database password"
-
Ok, at least you're not crazy.
-
Pika.......what? He has two numbers, 1-3 each. And he wants to know the odds of getting a 1,1.