Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. topflight, the code you posted looks like this: if (something) { do something } else { if (somethingelse) { do something else } } What it should look like is this: if (something) { do something } else { if (somethingelse) { do something else } } The second version makes it very easy to see what is inside each "if" and what is not.
  2. Ok I've found the problem. It's your indentation. You need to write your code like this: if (something) { do something } else { do something else } Notice how everything inside is indented, making it clear what runs only if the "if" is matched. When you fix your indentation, the problem with your code will be obvious.
  3. What does it do now, and what do you want it to do?
  4. Can you replace this: if(isset($_POST['apply'])){ with this: if(isset($_POST['apply'])){ print "<br>Received the form - going to check its validity next<br>"; and see if the message shows up.
  5. I would have the script check if fwrite() is supported, and check various other functions which might have equivalent functionality. If nothing is supported, then give the user instructions to install manually.
  6. Can you put this line above all the lines which mention $error : $error = '';
  7. Can you just do two inserts inside a transaction? Or is it possible to create your own ON INSERT trigger to do what you want done?
  8. Yep, PHP treats it as an advisory thing, not as a declaration of how you will use it. PHP is a bit loose in its enforcement of things like this. It enforces things when it is forced to (because it affects implementation), but lets a lot of other things go. Mark, you can call any method in php without instantiating the class, but php will generate a warning if it's not declared static.
  9. If it prints a blank page, then there IS an error in the script. The next step is to find the error and fix it. Can you post the entire script please?
  10. The curl options are listed here: http://sg2.php.net/manual/en/function.curl-setopt.php It looks like you need to set the username and password (-u), and also set the post data (-d), and make sure you are doing a post. Since the original command line had the -i option, you probably want CURLOPT_HEADER set to 1 rather than 0.
  11. Phpfreaks also has a mysql expert (and it's not me). I'm going to request that this post get moved to the mysql sub-forum so he can see it.
  12. PHP's default behaviour is to display a blank page if there is an error parsing the script. If you post your full script we can tell you where the error is. Otherwise you can switch on the "display_errors" ini directive in apache. You can't switch it on in the script itself, as the error occurs before the script executes. Or if you have access to a command line version of php, just run the script there. It will display the errors.
  13. From http://us3.php.net/manual/en/language.oop5.static.php "A member declared as static can not be accessed with an instantiated class object (though a static method can)." A static method is very different from a static member. A method is still the same method whether it is called statically or from an instance. Members are different because they require storage space, and they must be stored either globally (static) or per-instance (non-static).
  14. Sorry, I didn't notice the "tools" in the topic. And I don't know any unfortunately. I think you can legitimately double post this in the mysql forum if you haven't already. The mysql experts don't visit here, and maybe one of them can help.
  15. Do you mean data migration packages? I've migrated plenty from mysql to postgres, but always using table dumps and home made scripts.
  16. I don't understand what this does: {!firstname} I'm also confused about the flow of form submission. 1. User fills in form and submits 2. Form is accepted by which script? 3. After that script processes the form, what happens next?
  17. The result will be called "max", not "type", unless you give it an alias.
  18. Hi Doug, Actually my name is Brian, but I am a fan of Matt What is this code for: document.write(name) Can I also see the form? And do you call the url like this: increaseyouronlinetraffic.com/oto/?name=Matt If it is called like that, you should find "Matt" in the $_GET['name'] variable
  19. Is this your website that you want to fix? Can you post the relevant php code?
  20. Good question I got the 7 from here: Array ( [7] => 2 [5] => 2 ) But I guess the array will in general have different numbers there? In which case you need to loop through it: while ($row=mysql_fetch_row($result)) { $products = unserialize($row['10']); foreach ($products as $p_key => $p_val) { echo "products[$p_key] = $p_val <br>"; } } That will display each item in $products in turn. Once you decide how you want it displayed, just change that echo to something else, using $p_key and $p_val.
  21. You need to unserialize it first separately and then echo it, like this: while ($row=mysql_fetch_row($result)) { $products = unserialize($row['10']); echo "products[7] = {$products[7]}<br>"; } The {} syntax is another way of writing this: echo "products[7] = " . $products[7] . "<br>";
  22. Can you describe what you are trying to do? Are you trying to use the url of the page (eg '/tutorials.php') to determine which page you shoudl display?
  23. I think you need to spend more time on the basics of php. Play around a bit using this code: print "<pre>"; var_dump($pages); print "</pre>"; That will show you the contents of any variable ($pages in this case). You should do the same for $currentpage, so you can see what you are comparing against. This line: $choice = ($page['url'] == $currentpage); says "Compare $page['url'] and $currentpage. If they are equal, set $choice to true. Otherwise set it to false" When you try to print out "true", that's when you see 1. Instead you should be printing something from $page, eg "echo $page['choice']" or "echo $page['url']"
  24. Are you sure it's wildcard DNS itself that your host doesn't support? There are 2 components here 1. The DNS server must send all subdomains to you. This is "wildcard dns". 2. You must be able to handle all subdomains (that's what the strangehost script is about) If #1 is ok, then #2 needs to be done at the apache configuration level, as with the strangehost script But if #1 is not ok then there is nothing you can do. Only your host can fix that, unless you have access to edit your own dns records
  25. The reverse is like this: $original = unserialize($serialized); If it fails then the data was corrupted somehow (eg you may need to use mysql_real_escape_string() on the serialized string in your query).
×
×
  • 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.