-
Posts
15,227 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
Adding internal links to a google maps marker
requinix replied to twinytwo's topic in PHP Coding Help
Yes, you need to modify createMarker(). And load() too. createMarker() needs another parameter so it can know what the URL is. It could be passed the whole URL that it uses verbatim, or just an ID number which it turns into a URL. Doesn't matter. Then load() needs to grab that information from the XML (or wherever) and pass that to createMarker(). -
Use doubles for everything, then round all numbers to some maximum degree of precision. 1 + 2 might turn out to be 2.999999999978 so you round and end up with 3.
-
The code you posted... It has nothing to do with putting stuff into the database. Isn't that where the problem really is? Getting it into the database?
-
Let them classify themselves. Present three challenges ranked low, medium, and high, and open enrollment to everybody. I like to think the staff knows enough people well enough that we could tell when an A-rank coder solved the C-rank challenge. With that said, if there were badges respective of the challenge then that coder bragging about the "I can solve basic math equations" badge might not look for good for them.
-
Define "doesn't work".
-
This topic has been $verb->toPastTense() to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=354538.0
-
Replacing spaces with hyphones in .htaccess
requinix replied to spacepoet's topic in Apache HTTP Server
mod_rewrite cannot do substitutions like that. Technically it can, but it's absolutely ridiculous and should not be done. -
Not really. SMTP is a protocol for moving emails between servers. Programs use this protocol to send (and thus receive) email. There are many programs that handle either/both sides of that transaction. POP3 and IMAP are protocols for accessing stored emails. Both allow for retrieving email without deleting, both can keep or delete emails after the user has "deleted" them. IMAP is "better" because it has more features and fewer limitations.
-
Math.random is the main part, the rest is just details.
-
Off the top of my sleep deprived head (I'm at 21 hours I think): SQL injection, XSS injection, cross-site request forgery, SSL, and encryption practices to start. There are also a few nuances with PHP like the downsides of loose typing, how form variables are strings, scalars versus arrays from forms and how PHP can barf on them.
-
Only include the conditions if you actually need them. // multiple statements $query = "SELECT ..."; if ($condition) $query .= " AND table.field LIKE '%foo%'"; // one big query $query = " SELECT ... " . ($condition ? "AND table.field LIKE '%foo%'" : "") . "
-
The LEFTness only influences the join condition - if a WHERE condition excludes something, it'll be excluded. Does it show up if you drop all the worthless LIKE '%%' conditions?
-
Can you describe your situation more? It almost sounds like you're being a bit paranoid.
-
Sometimes yes, sometimes no, and it depends on the system. Assume the worst: you'll have the same file open by multiple processes all doing different things at the same time. You can, however, lock the file and eliminate the guesswork.
-
it equals zero but im still getting an echo?
requinix replied to Allenph9's topic in PHP Coding Help
You're a bit right but mostly wrong. static is an object-oriented thing, yes, but <?php blocks are not classes. If you're staying in the same file you don't need to "static" anything. The <?php blocks only control when PHP works; leaving one and entering another later won't affect your variables. -
it equals zero but im still getting an echo?
requinix replied to Allenph9's topic in PHP Coding Help
Do you know what "static" does? -
it equals zero but im still getting an echo?
requinix replied to Allenph9's topic in PHP Coding Help
Why are you using "static"? -
You can't. Which is why you'll have to come up with something that lets you (and mod_rewrite) tell the difference.
-
Use a JOIN, like JOIN this table again ON this table's parentid = the joined table's id and include this table again.name as one of the fields you retrieve. Throw in a few aliases while you're at it.
-
Do you have access to anything related to cron?
-
Which API is that?
-
Can you not fix the links to output in the right form?
-
Good, because I didn't want to try explaining things if you didn't care about it (no offense, I'm just lazy). You're looking for the exact string "" (case-insensitive). Regular expressions are overkill for that, but you need a count of matches and there is no built-in PHP function that can do that*. So now you have to create a regular expression meaning "literally ''". Two things: expressions need delimiters and [ and ] are special characters. What you had before "worked" because preg_match() accepts a [] pair as delimiters, but that meant you were actually only searching for "img". If you had the string To use img tags use "[img]". there would have been two matches. So the slashes in the expression are the new delimiters, preg_quote() turns an arbitrary string into something safe for regular expressions (turning the [ and ] into \[ and \]), and the /i flag means case-insensitive. Now that you're in the Regex forum, take a look at the stickies we have here. * substr_count() is case-sensitive.