Jump to content

GingerRobot

Staff Alumni
  • Posts

    4,082
  • Joined

  • Last visited

Everything posted by GingerRobot

  1. That's a ternary operator. It's a kind-of short-hand for if statements.
  2. As a start, you might like to take a look at this very good tutorial Incidentally, you'd be better off storing the team's IDs in the results table, rather than their names. You'd also be better off storing their score an an int.
  3. I think we're going to need to see your source code. This, for example, works fine for me: <?php class class1{ function __toString(){ return "Some string representation"; } } class class2{ private $data; function setData($s){ $this->data = $s; } function getData(){ return $this->data; } } $foo = new class1(); echo $foo."\n"; $bar = new class2(); $bar->setData($foo); echo $bar->getData()."\n"; ?>
  4. What are you actually hoping to achieve?
  5. This isn't a particularly good way of doing things - it involves far more queries than are necessary. You can do what you want in a far simpler way using joins. You might like to try this excellent tutorial
  6. You should validate that incoming request. You could, for example, ensure the id is a number. How are your image stored?
  7. Any particular reason why you're looking to use it? It generally makes things less secure and makes session hijacking easier. If you still want to know, take a look at this manual page
  8. Which page cannot be displayed, sendinfo.php or thankyou.html?
  9. Please don't do that. It's a very bad idea. What happens when you also want to store information about the track? What about if you wish to search by track name? You'll need a second table. mrMarcus, you might like to read up on database normalization. As for the question at hand, if you wish to do this in a nice, smooth manner you'll need to use some javascript - if you're happy with a page reload, have some buttons submit to the same page. Repopulate the forms with the current information and add a new input to your form.
  10. So do you receive the error message ("There has been an error sending your comments. Please try later")? Or do you get redirected, but receive no email/an incorrect email? Or is there some other problem? Also, in future wrap your code in tags - it helps us read what you've posted
  11. Or maybe, just maybe, you've annoyed everyone by being so impatient. The help and answers you might receive on these forums aren't something you're entitled to. People are giving up their own time in order to help, for free. I'm not going to sit here and claim they do it entirely out of their good nature - of course people gain something out of helping. However, you can't expect instantaneous replies to your questions. If it's that urgent, you should pay someone.
  12. Have you doubled checked the html source that's output by the above lines?
  13. Im sorry redarrow, but after 7.5k posts, are you really under the illusion that the above was at all helpful? It would seem you posted a query you found god-knows where which relates to a completely different database. While i might guess you're attempting to illustrate a join, do you really think the op is going to understand that, especially given the lack of explanation. It does nothing but confuse. To the op: I'm not quite sure i follow what you're trying to do. Can you post a bit more of your table structure? What's the desired output? Also, you may find this tutorial quite helpful.
  14. Well what did you actually try? There's quite a lot of code there so i'm not sure if any of it is actually relevant to the question in hand.
  15. You need to give your option tags a value attribute. For example: <select name = "selectfield"> <option value = "the value">The text displayed on screen</option> ... </select> The user will see the text between the opening and closing tag ("The text displayed on screen", in this example), whilst it will be the text in the value attribute that is sent to the server("the value", in this case). Oh. $HTTP_POST_VARS is depreciated(and has been for quite a while). You should be using $_POST instead.
  16. Well that kind of depends on what you're trying to achieve. If, as you said, you've read the tutorial on the main site, then you'll know there are various types of joins, each of which are used for different reasons. We need more information in order to answer your question. What fields are in the respective tables? What information are you looking to generate?
  17. One of the points of my tutorial was to avoid making multiple queries for something like this. You only need the one if you use an IN clause. You can validate using the array_map function prior to executing the query.
  18. You could always give the column in the result an alias and use that: SELECT week{$_SESSION['week']}opp AS week FROM opponents if ($results['week'] == 'whatever') { //other code here } That said, i've got a feeling you're going about this in a particularly bad way. Do you have an awful lot of columns in the table like week1opponent, week2opponent, ..., weeknoppponent? You should probably take a look at database normalization. This tutorial might be a good place to start.
  19. For the most part, use which ever you prefer. See this discussion (linked to from the php manual) : http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40
  20. Any decent CS degree shouldn't just have taught you language x,y and z. It should be more about the language-independent skills and underlying knowledge that mean you are capable of picking up a new language very quickly. Programming languages come in and out of fashion so any degree that focuses too heavily on those which are popular at the moment will inevitably have graduates who cannot cope 3,5 or 10 years down the line when the technology changes. Any decent employer will also know this and will recognise that just because you're not experienced with language x you can probably learn to use it quite quickly.
  21. You need to separate by the @ symbol or the : symbol. For that you need a pipe(|): $blah = split('[:|@]', $raw); Though i don't see why you're not delimiting by the same character in both instances?
  22. I think you missed the point of the code i posted slightly. You're use of variables passed in the URL are redundant, seeing as you're actually redirecting to separate pages. The next/previous text that my code outputs are the pages you need to link to. If you look at your page, you'll see text at the top "Next page:index01.php " - that's what you need to link to. There's a time limit on the edit in order to prevent an otherwise inevitable complete communication breakdown.
  23. Also it's entirely pointless doing anything with variables (or, indeed, anything at all) after returning from a function. The code is entirely unreachable - the program counter's already been returned to the caller and all the local variables of the function have been popped from the stack. So setting $end to 1 here is never ever ever executed: return $x; $end=1;
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.