-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
copy works too.
-
Isn't accessing a static variable from a non-static function bad?
requinix replied to AFTNHombre's topic in PHP Coding Help
That syntax is bad, yes. Accessing them in general is fine, but the way to do it is self::$FormatType Yes, PHP is tolerating the code, but somewhere it's creating warning messages (even if you can't see them). -
$offers is an array of offers. $object = array( "pages" => 2, "offers" => $offers ); JSON-encode that.
-
#194#160 is the UTF-8 encoding of a non-breaking space. So decode it first, remove the whitespace, and re-encode it.
-
You don't need more code for this. $max = min(array($sym, $res)); There. Do you understand it now? If you don't ever want $naq to be the minimum then don't include it in the list.
-
Is it possible to make a function that can generate a function?
requinix replied to hockey97's topic in Application Design
I would love to hear the actual problem you're trying to solve. The one that you think this generating-functions-at-runtime stuff is the solution to. Because honestly: this is all silly. There are much better ways. -
Use SimpleXML and an XPath query. If there's only the one in the whole document, //int[@name='reqJob']
-
number_format() doesn't quite do what you're expecting. Try round instead.
-
Is stripping out the HTML tags an option?
-
PHP 6 was scrapped. There are no plans for it whatsoever. Anything said about it is meaningless.
-
One per second? See, this is why I asked and didn't just give you a blind answer. You don't need AJAX for that. Pure JavaScript will be fine. Set an interval for every one second, and when your function fires increase the counter. That's all.
-
Are you using mysqli_connect()? Are you sure $dbc is an open connection?
-
You don't have to parse it yourself. SimpleXML will do that. If you don't know how to use it, check the manual for examples.
-
First word is "AJAX". Second word is generally like "auto-populate" or "auto-generate" or something like that. But basically it's just AJAX. When the one list changes you do an AJAX request to find out what should go in the next list. (And then you put the items in there.)
-
What are you counting? At (about) what rate does it normally increase?
-
Certainly possible. Start with SimpleXML.
-
Including files from another server user account, options?
requinix replied to PhunkRabbit's topic in PHP Coding Help
allow_url_include is unsafe and should never be used; allow_url_fopen is the "safe" one that should be enabled. Just to put that out there. Using something to automatically update (via FTP or whatever) is the best option, but it can take a while to set up a good system. Short of that, my suggestion is to "copy" the CMS for each client, but for the files that you want shared what you actually copy are a bunch of links* pointing back to the originals. Thus you can keep include()ing the same files. When you need to customize files you remove the links, copy the files, and make your changes. You need to make sure file permissions are set up on the originals so that anybody can read them - that could be the problem you have now. 0644 on regular files, 0755 on directories. * Symbolic. There's a chance that PHP will realize they're symbolic and take special actions (I don't know but I wouldn't expect it); those actions may screw up the whole idea, in which case you'd need hardlinks instead. -
What do you get if you print out $query?
-
With PHP there are many, many ways of doing something. Narrow it down to the methods that actually work and are safe (feel free to ask for help on that part) then pick the one you like best.
-
dirname() will only work in some of the situations. For example, it won't work with URLs like "/path/to/file.php?query_string". strtok(), or some similar method, will work on every URL.
-
So update $nwhatever every time it gets adjusted in the database. That way you don't have to keep looking it up.
-
bin2hex Spoiler: "octet" was the right term.
-
Almost have an Autosave function working - w/jQuery
requinix replied to tcnjdeluca's topic in Javascript Help
Maybe a description of the problem you're having?