-
Posts
471 -
Joined
-
Last visited
-
Days Won
8
Everything posted by dalecosp
-
function seems to be working on one server, but not another
dalecosp replied to skygremlin's topic in PHP Coding Help
Not quite sure, but I think that Is a rather newly-available syntax that wasn't supported as long ago as 5.3.0. edit: Boom. Cho0cu3r beat me to it. -
It works fine here. Have you done a var_dump at each stage of processing to see if something's funky? <?php /* Uncomment each commented line in turn and see what's up. */ $date1 =date_create("2013-12-07"); //var_dump($date1);exit; $date2 = date("Y-m-d"); $date2 = date_create("$date2"); //var_dump($date2);exit; echo "<br>"; $Gap = date_diff($date1, $date2); //var_dump($Gap);exit; echo $Gap->format("%a days"); Also, what system are you on?
- 6 replies
-
- ajoo
- difference between 2dates
-
(and 1 more)
Tagged with:
-
Heh heh, may have to hit up cuz and let him know your idea ;-) ;-)
-
LOL ... no, not *quite*. Just a programmer. Glad to hear it!
-
For a quick hack, try changing this: $target_page_num = !empty($target_page_num) ? $target_page_num[2] : 0; to this: $target_page_num = !empty($target_page_num) ? $target_page_num[0] : 0; Not sure it's right, though --- YMMV and all that.
-
Well, at least, this much is wrong: header("KitchenDatabase.html"); header() requires more than that. Try this: header("Location: KitchenDatabase.html"); (And technically, to match the HTTP Specification, it should be a fully-qualified URL (site.com/name) in the Header().)
-
Yes. You're welcome. What is the error? You're assuming that something exists that doesn't. $row doesn't have ['id']['quantity'], it only has $row['id']. What's in that ID field? And what are you trying to accomplish ... counting something?
-
Hmm, yes. So, what, then ... a DATEDIFF() call, maybe?
-
And the answer: yes. I'd do it that way, fife.
-
So, mac_gyver, could he use FROM_UNIXTIME() in that query to make it happen without changing his DB schema? WHERE DATE_FORMAT(FROM_UNIXTIME(StaffDOB),'%m%d') BETWEEN DATE_FORMAT(CURDATE(),'%m%d') AND DATE_FORMAT(CURDATE() + INTERVAL 14 DAY,'%m%d');
-
The problem is that you've recorded the birth-YEAR in the UNIX timestamp. 1984 was 29 years ago, and is (fairly obviously) not between CURDATE and CURDATE+14. I'd go out on a limb and say that maybe a Unix TS (as much as I like to use them) wasn't the best choice for a birthdate here. There might be some magic in SQL that's beyond me that could help, but I'd recommend thinking up an additional table and scripting something in PHP to get some birthday data that you can use more easily.
-
You'll want to use some valid SQL for this: $select = mysql_query("SELECT "); //this won't work :-( //try this instead $movies_table = "name_of_your_table"; $query = "select no,name,price from $movies_table where price >20 order by price DESC;"; $select = mysql_query($query);
-
Solving Search function with pagination problem
dalecosp replied to tapantor24's topic in PHP Coding Help
Come on now friend ... it's not THAT hard //lines like these will need changed: echo "<span><a id='page_a_link' href='info5.php?page=$j'>< Prev</a></span>"; //needs phone parameter echo "<span><a href='info5.php?page=$i' id='page_a_link'>$i</a></span>"; //needs phone parameter //to this echo "<span><a id='page_a_link' href='info5.php?page=$j&phone=$phone'>< Prev</a></span>"; //has phone parameter echo "<span><a href='info5.php?page=$i&phone=$phone' id='page_a_link'>$i</a></span>"; //has phone parameter //At the top, because you're only POSTing the first time (and using GET thereafter), you will need something like: if (isset($_POST['phone'])) { $phone = $_POST['phone']; } elseif (isset($_GET['phone']) { $phone = $_GET['phone']; } And you probably should consider some type of validation on the phone variable as well, unless you're certain that it won't be viewed by anyone except people in your own company. -
Well, what sort of projects have you done so far? Typically, here's what happens. 1. A set of requirements are created. What should this do? What functions will the software be able to do, what might the interface look like, how will it be supposed to operate (with what, upon what, etc.)? 2. What strategies can be used to implement the functionality, the interface design, and the operations from #1? 3. What will need to be created to implement these strategies? (Usually that's files with code in them ;) ) 4. Either write up #1-3 and submit it for approval, and start coding ... or just start coding 5. Test. Rewrite what's necessary. 6. Test some more. Evaluate if the design goals have been met. 7. Repeat steps 5-7 until you feel you can foist it on the public without damaging your business. 8. Deploy. ... or at least it's SOMETHING like that
-
Regex to match and return all anchor tags in a string
dalecosp replied to kyleabaker's topic in Regex Help
Yeah, that's what I use; he didn't say if it was a requirement ... never can tell when people are doing coursework ;) -
PHP Parse error: syntax error, unexpected '<script', expecting '<?php' in /usr/home/stradmadhu/original_post on line 1
-
Regex to match and return all anchor tags in a string
dalecosp replied to kyleabaker's topic in Regex Help
Try spaces, newlines, etc? Or, perhaps, use something like DOMDocument to read the HTML instead of a regexp. -
$_SERVER["REMOTE_USER"] blank.. but not really?
dalecosp replied to jgauthier's topic in PHP Coding Help
I'm tending to think the key to this is in the original post ... ... unfortunately, all I've ever done with proxies is cache and deny access to pr0n sites. edit: And Woah! Gotta love English ... "cache site pages and deny access to..." -
Solving Search function with pagination problem
dalecosp replied to tapantor24's topic in PHP Coding Help
If you're sure that products *should* be found on a second page, have the script echo the values of $start and $perpage to you just before the query ... it may be that these values are not what you expect. Also, please consider using the [ code ] BB tags for your code -
Because you have "width: 700px;" on that element, maybe?
-
Best way to test my PHP code for inefficiency?
dalecosp replied to njdubois's topic in PHP Coding Help
If I recall from the other thread, part of the problem is that it's on shared hosting and you've got little control and almost no tools to work with. Would it be possible to create a server (even a VM ... that might be perfect for the task), and run some of the standard tools on it (I mentioned some of them there). I use Oracle's VirtualBox on my Win7 workstation @work ... works very well for development, and I can run whatever I want in it. -
Where is it you're taking your classes, again?
-
Well, you'll probably want to talk to the other party, then. Do they have docs somewhere? Tech support?
-
The canonical way to do this is with DOMDocument; however, you should probably check with the bank (or at least search the bank's site) to see if this is even permitted by the bank's Terms of Service. You may have to call or write to them and ask if an API exists. Alternately, there are quite a few sites that can offer this sort of service, I think. For example, Google probably has an API (they certainly have the app online themselves).
-
What does $output say, then? Who controls "myurl.com/api" ... and if it's you, does it produce output ... log files ... error messages? What does the API look like? Pretty hard to guess with not much to look at besides a short script and a description of the issue. It's a two-part system, and there's at *least* a 50-percent chance it's the handler, I'd think. No insult intended ... but these seem to be important questions that you've not told us about yet. :-)