Jump to content

requinix

Administrators
  • Posts

    15,229
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. Alright folks, a little less sarcasm if you don't mind. The file has to be included. The variable has to be defined in that file (or some subsequently included file) and has to be done in the global scope. If either of those doesn't happen then $mysqli will be undefined and the code will not work.
  2. I've done the same for you.
  3. Okay, so maybe one organization does...
  4. You can get the IP address with $ipaddr = (isset($_SERVER["HTTP_X_FORWARDED_FOR"]) ? /* proxy */ $_SERVER["HTTP_X_FORWARDED_FOR"] : $_SERVER["REMOTE_ADDR"]);Put that into the body of the email however you want.
  5. What's $m->get/set? Caching? Is that working correctly? It doesn't look like the ->get is setting any sort of TTL or expiration time...
  6. Yeah, there's no real additional complexity being added: you make commits like normal (except you can do them offline), but now there's the added step of pushing changes to a remote server when you feel like it; I have a couple projects that have commits I haven't synced to GitHub in a long time, but I still get the benefits of source control. Another argument in favor: learning how to use Git. Subversion starts breaking down when you have multiple developers on the same project, so if you want a career doing software/web development in a company then you'll need to learn Git... or Mercurial, it exists too, but I've never actually seen anyone use it.
  7. Subversion? What year is this? Git is where it's at. Netbeans? The "uploads file" and "commit the changes" things are two separate mechanisms: you can save a file (and thus automatically upload it, if your project is set up correctly) without having to make a commit for it. The svn directory can go anywhere as long as you aren't uploading it to the site - because then you'd be constantly uploading lots of files that don't need to be.
  8. 1. You need a DirectoryIndex directive somewhere that instructs Apache to use index.php as the default "index" file when accessing a directory. I would have expected XAMPP to do that for you, but maybe you have to do it yourself in the virtualhost configuration. 2. You don't have the mbstring extension installed. Check the phpMyAdmin installation instructions to see if there's anything else you missed.
  9. The version of Imagick you have installed does not match with the version of PHP you have installed. Download and/or compile and install the correct one.
  10. The thread was originally posted to PHP Applications. I moved it here, so OP isn't technically looking for critiques... I just figured that was better than deleting it.
  11. Prepared statements mean the developer does not have to escape the data manually. The developer is already escaping the data manually. Therefore prepared statements are not required.
  12. Actually we were thinking more about the code that sends the email. The older code, I guess, that was running slowly. If you have cron and we can't figure out the email problem then it's not too hard to make a periodic emailing thing. But as benanamen said, you shouldn't really have to resort to that...
  13. Well, tthere's a typpo on that oone line there thhat will prevent any Javvascript from executinng at alll...
  14. As opposed to what? That is valid so there's nothing inherently wrong with it. The method you're using is fine.
  15. How much access do you have on the machine? Is it dedicated? Shared? You have access to cron?
  16. If you think about it and look around, sure you can tell that the username is somewhere else. But Jacques' title, for example, really looks like a username. And I've seen a few people get called "Newbie". Honestly, putting the username above seems odd to me. That blue bar looks like spacing between posts and it wouldn't be hard to visually skip past it and go right to the little label above the user's avatar. But I wouldn't mind IQ tests for... well, most parts of life. Programming. Voting. Buying a home. It's discriminatory but it would save lots of people lots of time and hassle.
  17. I moved the title: it used to be above the avatar, now it's below. Sometimes there's confusion about the title looking like the name (when it's actually in the bar above the post) so maybe this little change will help with that. For future reference: global templates > userInfoPane
  18. I'm going to ignore the SQL injection and go for the question itself. In a case like this I would do a GROUP BY + HAVING COUNT SELECT id FROM fruit WHERE fruit_name IN ("apple", "banana", "orange") GROUP BY id HAVING COUNT(1) = 3Make sure the id + fruit_name pair is unique, even if the two aren't individually.
  19. Another suggestion is to break the dates into separate date and time components. That makes matching up dates and reservations more efficient as you won't need to DATE() anything. The basic approach to the query is to start with the table you want data from (dates) then use a JOIN on another source (reservations) to filter out records you don't want. SELECT d.date, d.time, r.count FROM date table AS d JOIN ( SELECT date, COUNT(1) AS count FROM reservations GROUP BY date HAVING count < 80 ) AS r ON d.date = r.date ORDER BY d.date, d.time The filtering (count
  20. The name of the node is just "Fee". The rest of it is an attribute of the node.
  21. So SUM(number of reservations) GROUP BY DATE(date) Given what you said above, why do the times matter? Do they not matter, and in this example where the date only has two times you're just mentioning them with the date? One possible improvement would be to relate reservations to date IDs, not to the dates themselves. Reservation# | Date ABC123 | 1 ABC456 | 1 ABC667 | 1 ABC777 | 2 etc | etcIt could help with the JOINs or subqueries you will inevitably do.
  22. We can't just give you the code - you wouldn't be learning PHP if we did. But we'll help you write it. What have you done so far?
  23. If you want basic help then you have to post some basic information so we can have a basic idea to what sort of basic assistance we should provide. Basically.
  24. You've managed to copy the code from the fgetcsv documentation so you have that much working correctly. Next step is to write the code that does the "search" according to the values in $data: if the value matches then do whatever, if not then don't do whatever.
  25. It seems a bit silly but I'd still do the two conversions: I object to piecing the JSON together by hand on principle, and decoding the strings doesn't take that much code. $a1 = [ ['x' => 321, 'y' => '{"a":5,"b":"hello"}'], ['x' => 321, 'y' => '{"a":2,"c":"goodby"}'], ['x' => 321, 'y' => '{"a":5,"b":"hi","d":"please"}'] ]; $a2 = ['foo' => 123, 'a1' => $a1]; array_walk($a2['a1'], function(&$v) { $v['y'] = json_decode($v['y']); }); echo json_encode($a2);
×
×
  • 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.