-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
Rewrite from /page/home to /?page=home. RewriteRule ^/page/home ?page=home [L]If that doesn't work then try without the first slash: ^page/home. Do you have more pages that go from /page/abc to ?page=abc? If so you should make a generic pattern for all of them...
-
What's your current code? "Otherwise"? I don't see anything that says "if the form has been submitted then...", which should be somewhere to pair up with this instruction. I agree with Fou-Lu on codingforums.com: the instructions are odd, nevermind that the sequence of steps in richei's code is better than what you're being told to do. I suggest you talk with your teacher and get things straightened out.
-
Actually there always were those errors, you just weren't seeing them on the other server. The difference is that this new server is configured to show them. Add those exit;s I was talking about. And FYI you're open to SQL injection via $sid. Probably. I'd have to test to see if PHP rejects invalid SIDs.
-
static keyword and scope resolution problem
requinix replied to Jaswinder's topic in PHP Coding Help
Works for me. What error are you getting? -
For #2 you didn't literally follow the instruction, but your end result is exactly the same so I think that'll be fine. (You were probably intended to put the values directly into $validations without those temporary variables, but like I said it's all the same.) #4 is weird. You did what it said but what it said is... odd. Think about it for a second. In the foreach loop the $index will be the array key and the $validation will be the value. Right so far. But the index doesn't really do a whole lot. Since you aren't using custom array keys they'll just be numbers: 0, 1, 2, and so on for each item. Checking "if the index is empty" doesn't get you anything. Ooh, it's a number. So? What the instruction should probably be is But clear that with your instructor before you change your code.
-
It'll sort by the first field first, and when two values are the same then it'll sort by the second field. Seems like you need something more complicated than that. Have some sample data and how you would want it sorted? [edit] Example: a ASC b ASC a ASC b DESC a DESC b DESC a | b a | b a | b a | b --+-- --+-- --+-- --+-- 1 | 1 1 | 1 1 | 3 3 | 3 2 | 2 1 | 2 1 | 2 2 | 3 3 | 3 1 | 3 1 | 1 2 | 2 1 | 2 2 | 2 2 | 3 1 | 3 1 | 3 2 | 3 2 | 2 1 | 2 2 | 3 3 | 3 3 | 3 1 | 1
-
Google's Custom Search Engine (CSE) lets you search just a particular website. Last I knew you could embed that in your site with just some HTML and Javascript.
-
Read the first sentence I wrote. You know, what came in my post before I quoted that thing you said and (I would argue) the comment one could deduce was what the remainder of my reply addressed. I was clarifying something you did not, in fact, understand correctly.
-
static keyword and scope resolution problem
requinix replied to Jaswinder's topic in PHP Coding Help
static::$test only works if you have PHP 5.3+. If you don't then it will definitely create an error. 1. Static things (constants, static variables, static methods) 2. Used with self, parent, and static keywords and even for instance methods (eg, parent::__construct) Yes: static variables, static methods, and with PHP 5.3+ the statically-called class. No. PHP does not have static classes. You could call a class "static" if you so wanted by marking it final and making the constructor private but it's not a true static class. It's not true inheritance: self:: and parent:: don't respect the inheritance hierarchy (static:: does) and you don't have to respect the parent method's signature. Yes because they're static. Can't create a new non-static property/method with the same name. -
CSS. Whatever you have applying to regular and submit images probably isn't applying to the button>img. [edit] Maybe your CSS is removing borders on a>imgs only?
-
That is the correct syntax. What's not working? If you're talking about what I think you're talking about, that's only when you need to change how the default behavior, and it mostly just happens when mixing ANDs and ORs. If you say something like "I want all posts by requinix or justin7410 and that have been made since June 1st" then you might write WHERE username = "requinix" OR username = "justin7410" AND date >= "2013-06-01"but what that actually says is "posts by requinix, or posts by justin7410 this month". Because ANDing happens before ORing*. If you add parentheses WHERE (username = "requinix" OR username = "justin7410") AND date >= "2013-06-01"then you override that and get the desired result. * In terms of precedence and what happens when you mix the two together. They are still evaluated left to right.
-
match very specific letter/nummber combo inside of text
requinix replied to cindreta's topic in Regex Help
Ah, the word boundaries I added. I didn't really notice that you already require parentheses around the code... things... so the \bs aren't useful. (And make it fail.) #()?\(([son])([0-9]+)\)(?(1))#i -
match very specific letter/nummber combo inside of text
requinix replied to cindreta's topic in Regex Help
Stick a + after the number range, like [0-9]+. It means "one or more of the previous". Also, - You can get rid of some of the backslashes - If you use # as the delimiter then you don't have to escape the /s - Throw in some \bs (word boundaries) to avoid some false positives like "ilikeeatingcakes99" #()?\b\(([son])([0-9]+)\)\b()?#i- If you're worried about things like Would remote the closing tag S99 you can use a conditional subpattern #()?\b\(([son])([0-9]+)\)\b(?(1))#i -
Or you can use the often-overlooked which does support images.
-
There is nothing in there that depends on a particular version of Apache. Odds are the provider is wrong and that there is a difference somewhere else. What difference should you look for? It'll be much easier to tell if you can explain what "doesn't work" means. Because we can't read your mind. [edit] Though you should fix one thing: if you redirect with a header() then you need to exit; or die; immediately after. Otherwise PHP will keep on executing your script.
-
Making the Table main column name as a variable based on data in a row
requinix replied to Quostin's topic in PHP Coding Help
Oh, and that's exactly what mac_gyver was telling you to do in that other thread. Please don't make multiple threads for the same topic so people don't end up repeating the same things like I just did. -
Making the Table main column name as a variable based on data in a row
requinix replied to Quostin's topic in PHP Coding Help
Normalize. You should never be adding more columns to a table unless you're fundamentally changing the structure of the data. If you have multiple pieces of data then you should be using multiple rows for them. Like this: monsters id | name ---+------------------- 1 | Small Purple Slime spells id | name ---+---------------- 1 | Rock Throw 2 | Ground Collapse 3 | Earth Prison 4 | Terras End monster learning monster | level | spell --------+-------+------ 1 | 2 | 1 1 | 3 | 2 1 | 4 | 3 1 | 5 | 4 -
You generally don't need to because browsers will do it for you, but that's only because websites don't always do it themselves. So you should try to. $file = "Some Band - En français avec des caractères spéciaux (2013) [7'' EP].zip"; echo "<a href='http://www.mydomain.com/downloads/" . htmlentities(urlencode($file)) . "'>Download</a>";urlencode() because you're putting something into a URL, then htmlentities() because you're putting that into HTML.
-
It's templating. Heard of Smarty? That, and others like it. Basically it works by having some PHP code that "evaluates" the template by doing things like "find all instances of {var} and replace them with the value of var". And potentially more advanced stuff. It's web development for people who can't write PHP.
-
Can you post your website so we can see it ourselves?
-
Notice, folks, that the thread is from January. Fehnris and Gradial both bumped the thread for some reason.
-
Actually line 15 is $query = $_Get['query']; That difference matters.
-
A table each for the users, the topics, and the votes. With database normalization (the topic we're on) don't be afraid to be more verbose and split things up, because doing the opposite is actually bad.
- 10 replies
-
- databasemysql
- tables
-
(and 1 more)
Tagged with: