-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
Things like avatars and signatures are, like, always disabled, but timezones? I'd never seen a place that disabled that too...
-
What have you tried so far and what part of it do you need help with?
-
Uh oh. I hope this isn't one of those things that's not available until after you've been around for a while... "Time Zone". Right near the top of that page.
-
Class secondCalculator extends Calculator { $this->total = $this->number3 + $this->number4; }Where are the methods? You can't just put code into a class. It has to be inside a method. secondCalculator adds the concept of a number3 and number4 so you'll need methods for that. Like "setNumber3" and "setNumber4". You'll also need a method to do the addition: either "Calculate" which will replace the one in Calculator, or another method entirely.
-
When in doubt, check the documentation. So $price1 = $prices[array_rand($prices)]; $price2 = $prices[array_rand($prices)];
-
Any errors at all? You can't just pick a bit of code, decide the problem is in there, and ignore problems that happen in the rest of the script.
-
The first form should work fine. Where is $searchquery getting its value? What is the value of $sqlCommand when it is being run and returning no results?
-
Run your script in a browser. Do you see any error messages from PHP?
-
301 redirect breaks my mod_rewrite rule
requinix replied to craigj1303's topic in Apache HTTP Server
What you do is redirect requests that are for literally the "/index.php..." pattern you're rewriting to. The catch there is the term "literally". RewriteCond %{REQUEST_URI} ^/index.php\? RewriteCond %{REQUEST_URI} [?&]page=show_range(?=&|$) RewriteCond %{REQUEST_URI} [?&]range_id=([a-zA-Z_0-9]+)(?=&|$) RewriteRule ^ /ranges/%1 [L,R=301]Note that you can't simply do RewriteRule index\.php?page=show_range&range_id=([a-zA-Z_0-9]+) ranges/$1because the friendly rewriting you're doing will conflict with that (mod_rewrite will match this rule against the new URL too). Nor should you do RewriteCond %{REQUEST_URI} ^/index\.php?page=show_range&range_id=([a-zA-Z_0-9]+)because the query string might have the parameters in a different order. -
301 redirect breaks my mod_rewrite rule
requinix replied to craigj1303's topic in Apache HTTP Server
You don't want to tell Google the page has moved. As far as it, or anybody else, is concerned the page is actually located at that friendly URL. If anything you would redirect requests for the old index.php URL to the new friendly URL, which is technically optional but a good thing to do for SEO. -
We'll need to see code and a description of what it is, what it's supposed to do, and what it actually does instead.
-
What am I doing wrong? Not getting errors in log
requinix replied to ballhogjoni's topic in PHP Coding Help
What's in the rest of the script? What kind of errors are you expecting to see logged? -
Find a color picker and play with it until you find the right color. For that site, the large square varies the color shade (saturation and brightness) and the vertical strip varies the color (hue). But where will the color be used? On a monitor? Printed photo? Printed text? The final result won't always look the same as what you started with.
-
php multidem array - assign keys to identify each set
requinix replied to quasiman's topic in PHP Coding Help
Into $query? 1. Get rid of the second foreach loop. Just stick all of its code into the first one. And make $data just a temporary variable, not an array of everything. 2. Work the $type into $query. How depends on what you want $query to look like. [edit] And don't by-reference $value. It's dangerous. -
Because without those backslashes, PHP thinks the first quote is ending the string. Just like the one at the end is actually doing. The backslash tells PHP that you want a literal quote character there.
-
Have you checked the Javascript error console in your browser? I see a couple "cannot read property" errors, "undefined is not a function", and apparently some font files 404ed.
-
We have a forum specifically for mod_rewrite and URL rewriting questions, so while Regex is close, this place is actually better. No worries though. There's three ways you can go about this and they all look and work about the same: 1. Do one RewriteRule for the folder you want to ignore and make it do nothing - except stop the rewriting. Then the second RewriteRule can just redirect everything it sees. RewriteEngine on RewriteRule ^install(/|$) - [L] RewriteRule ^ http://www.bbc.co.uk%{REQUEST_URI} [L,R=301]2. Use a RewriteCond to make sure the RewriteRule only applies to the folders you want it to. RewriteEngine on RewriteCond %{REQUEST_URI} ^(?!install(/|$)) RewriteRule ^ http://www.bbc.co.uk%{REQUEST_URI} [L,R=301]3. Make your one RewriteRule exclude that folder, which is what you're aiming for. RewriteEngine on RewriteRule ^(?!install(/|$)) http://www.bbc.co.uk%{REQUEST_URI} [L,R=301]If you're wondering, the (?!...) construct translates to "... does not match here".
-
correct syntax for for loop count two variable?
requinix replied to Yohanne's topic in PHP Coding Help
I don't know what you're trying to do with $q and $x, but if you want to deal with their counts and not let $i get above either, $i -
How to display a variable filename picture in a directory above web?
requinix replied to lost_toys's topic in PHP Coding Help
header()s and readfile() in a script. header("Content-Type: image/png"); header("Content-Length: " . filesize($path)); readfile($path); exit; -
substr will give you a piece of a string. If it has >=3 digits then add a colon between the first and second characters. If it has 5 digits then add one between the fourth and fifth (because you added a colon earlier) digits.
-
How about posting the version that doesn't work? What kind of string value and what are you actually receiving in your PHP?
-
That [name=like] selector you have only applies when adding the event handler. Changing the name won't suddenly make the other handler be applied to it. Use just one handler for both like and unlike, and use the class/title/name to decide what action to take.
-
Another way of describing that is adding an id=123 to all LIs that don't already have an id=*123*. Use DOMDocument. $html = <<<HTML <ul> <li id="123_1" title="" value="1">Banana</li> <li id="123_2" title="" value="1">Apple</li> <li>Pear</li> <li title="" value="1">Watermelon</li> <li id="456_2" title="" value="1">Tomato</li> </ul> HTML; $dom = new DOMDocument(); $dom->loadHTML($html); foreach ($dom->getElementsByTagName("li") as $li) { if (!$li->hasAttribute("id") || !fnmatch("*123*", $li->getAttribute("id"))) { $li->setAttribute("id", "123"); } } $output = ""; foreach ($dom->getElementsByTagName("body")->item(0)->childNodes as $child) { $output .= $dom->saveHTML($child); } echo $output;The final $output stuff may vary depending on what your input HTML actually is. ... You do realize that it's not allowed to use the same ID for multiple elements, right?