ManiacDan
Staff Alumni-
Posts
2,604 -
Joined
-
Last visited
-
Days Won
10
Everything posted by ManiacDan
-
Depends on how many people will be rejected and how you want to handle that. If a very small percentage will be in "rejected" or "pending" state, then the enum is a good idea. If a large number, a separate table may be faster.
-
Populate Php Session Variable When User Clicks A Checkbox In Form
ManiacDan replied to MockY's topic in Javascript Help
If you don't know anything about ajax, we can't teach you from the ground up. The basic idea is that the request object allows javascript to call a URL and retrieve some formatted data, then parse that data and perform relevant actions. You'll need to write a page that accepts a value (maybe a cookie) and returns the relevant data you're wanting as a bare string. Then look up how to do an AJAX GET request using jquery (or by hand). Have the ajax request hit the page you wrote, then move on from there. -
INSERT INTO PER_MEMBER ( SELECT * FROM TEMP_MEMBER WHERE MEMBER_ID = 123 ); Also, this is not PHP in any way.
-
What do you mean by "work"? What are you trying to accomplish?
-
FULLTEXT is fine, but you'll still have to pre-process the string. Or my solution with only `name` WHERE `name` LIKE 'Jo%' AND `name` LIKE 'Doe%';
-
What To Use Instead Of A Mass Switch Case Randomly
ManiacDan replied to Tidehunter's topic in PHP Coding Help
Thread closed. -
What To Use Instead Of A Mass Switch Case Randomly
ManiacDan replied to Tidehunter's topic in PHP Coding Help
If you have an actual question, go ahead and ask it. Your quick example was bad PHP code, and you haven't explained what you are trying to do. There isn't a great way for us to help you if you don't describe a problem or provide actual code to look at. -
Php On A Seperate Business Logic Server From Web Serve...how?
ManiacDan replied to bluesclues9's topic in Apache HTTP Server
What I'm saying is: What purpose does this entire server serve if it does nothing but forward all requests to a second server? if I try to hack your server, this "proxy" will just forward my hack attempts along. You've never seen this before because the thing you're trying to do doesn't make any sense. I've worked with systems where business and display logic were on separate servers. They used an internal API. But your system is already designed, and you have just now thought about this problem. It's too late to separate your logic into different servers. -
Php On A Seperate Business Logic Server From Web Serve...how?
ManiacDan replied to bluesclues9's topic in Apache HTTP Server
What is the purpose of this separate server? Does it work as a firewall? Why is it there? If all it does is forward requests to your php server, you already have a machine that does that: Your router. -
What To Use Instead Of A Mass Switch Case Randomly
ManiacDan replied to Tidehunter's topic in PHP Coding Help
That switch isn't even correct, that's not how switches work. The most efficient way to do this is with an if/elseif tree. -
You already agreed you were starting from the root. Why did you say that if you aren't sure what it means? The "root" of something is the base of it. C:\ is the root of a windows file system. / is the root of a *nix file system. phpfreaks.com/ is the root of phpfreaks. You should start from your "web root" for file includes so you always know you're getting the right file regardless of where you are in the filesystem.
-
Reply #2 contains the correct solution.
-
So you're saying that this is impossible/undesireable: $a = new a(); $a->foo(); unset($a); So instead you make a function bar() on A: public static function bar() { $a = new a(); $a->foo(); } Why? All you're doing is causing a class to nest inside a non-instantiated version of itself. It's confusing and entirely unnecessary. All you're doing is adding overhead and seriously confusing code.
-
Why would you do it that way? Static methods exist so you don't have to instantiate the class. Why would you then instantiate the class inside of a static method? What's the purpose of that?
-
Only static functions can be called statically. To fix that error, add "static" to your method declaration for the other method. And before you ask: you no cannot call a dynamic method from a static one. Bravo for having error-reporting turned on, well done.
-
self::functionName()
-
You also spelled $database wrong. Read up on PHP's variable scope
-
There's no reason why this isn't working the way you wrote it here. Are you creating $thing inside a function?
-
If you really love split, I have good news for you: Actually reading the manual page would give you 4 alternatives to split that actually work properly and aren't deprecated. Parse_url pulls out the query string, then parse_str will parse the query string for you. That's the only correct way to do this. You can continue splitting the string if you want, but I've already demonstrated a valid URL which will break your method and not mine.
-
If you don't get an error when you run this code, you have errors turned off, and that's bad. As a language grows (any language), new features are added. Some of those new features are better, more efficient, or more secure versions of old features. The old features are then deprecated (marked as "old"). After a few more version, deprecated functions are removed entirely. Functions like ereg, split, and register_globals, as well as variables like $HTTP_POST_VARS are deprecated. Soon, they'll be gone. Right now, your code throws an error. Maybe when PHP6 comes out, it will stop working. Just because something is possible doesn't mean it's the best way to do something. You're trying to parse a URL. The function I pointed you to is called "parse url." Using a deprecated regular expression engine (which is really slow) to split it into uneven chunks in the hopes that it comes out with the right answer is just...not going to work out well for you. For instance, this is a valid youtube URL: http://www.youtube.com/watch?v=ruJ1uFf9hy4#t=2m14s Your code would break on that. Using parse_url would not.
-
I could have sworn christian said urlencode, not htmlentities. Yes, htmlentities is "more valid."
-
That's why it's discouraged. The manual is absolutely the best PHP resource you can get. You have to read it.
-
I have no script to share, I linked you to the manual page of a function which does exactly what you're asking for. Read the page, learn something new, and apply that knowledge to write a script. Speaking of the manual, did you happen to read the manual page for the split function you're using? See the big red box that says using the function is highly discouraged?
-
Show the whole line of HTML source. Are there quotes around the href value? The ampersand should not be encoded, since the link needs to have it in order to work.
-
You could also use parse_url for this.