-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
PHP Fatal error: Call to a member function query() on a non-object
requinix replied to Texan78's topic in PHP Coding Help
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. -
I've done the same for you.
-
How do I set up Subversion without requiring commits to test?
requinix replied to DeX's topic in Other Web Server Software
Okay, so maybe one organization does... -
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.
-
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...
-
How do I set up Subversion without requiring commits to test?
requinix replied to DeX's topic in Other Web Server Software
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. -
How do I set up Subversion without requiring commits to test?
requinix replied to DeX's topic in Other Web Server Software
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. -
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.
-
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.
-
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.
-
Add form submission to database and send an email too
requinix replied to VipulK's topic in PHP Coding Help
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. -
Add form submission to database and send an email too
requinix replied to VipulK's topic in PHP Coding Help
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... -
Well, tthere's a typpo on that oone line there thhat will prevent any Javvascript from executinng at alll...
-
As opposed to what? That is valid so there's nothing inherently wrong with it. The method you're using is fine.
-
Add form submission to database and send an email too
requinix replied to VipulK's topic in PHP Coding Help
How much access do you have on the machine? Is it dedicated? Shared? You have access to cron? -
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.
-
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
-
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.
-
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
-
The name of the node is just "Fee". The rest of it is an attribute of the node.
-
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.
-
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?
-
desperate postgrad student in need of some basic help!
requinix replied to lenny86's topic in PHP Coding Help
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. -
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.
-
Including JSON in JSON_ENCODE without adding escape characters
requinix replied to NotionCommotion's topic in PHP Coding Help
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);