Jump to content

ManiacDan

Staff Alumni
  • Posts

    2,604
  • Joined

  • Last visited

  • Days Won

    10

Posts posted by ManiacDan

  1. well you gotta start somewhere right?
    When teaching someone English, don't start with how it was in the 15th century. Start with today. You're learning PHP so out of date it's actually dangerous and won't work on a modern web host.

     

    As for ereg: It's a family of functions which has been entirely replaced by the preg family of functions. Ereg is simply old, vestigial, deprecated functionality, left in the language for just a few more years to give out-of-date developers a final chance at updating their code.

  2. 1) You're not really getting client-server programming. PHP runs and generates a text document, then dies. Then that document shows up on the client's screen (there's overlap, but I'm simplifying for this description). Once the document arrives at the client, the client's browser parses it and does what he needs to do. If the document is plain HTML, it's rendered (you would place tables and images using HTML and CSS). If the document contains javascript, it's executed (you would auto-populate tables after the fact using Ajax). PHP doesn't know it's printing HTML. PHP has no idea about the shape or layout of web pages. PHP makes a string.

     

    2) Everything you mentioned here is javascript functionality. Write the javascript function which handles the onchange event for the drop-down and puts the correct image tag in the correct place on your website. PHP can be used to tell javascript where those images are located. The function should be generic so it can be in a .js file, but the drop-down should be generated from PHP using the current values in the table.

     

    3)

    *********BTW, I will be creating in Dreamweaver cs5 if that matters.
    Don't do that. You're not writing code when you're using dreamweaver, you're letting an automated software make a best-guess effort at potentially-working code.
  3. Both "join" and "left" are reserved MySQL keywords and must be enclosed in `backticks`. You're also missing a comma after "left"

     

    The reason why you're not getting an error is because you're probably not checking the results of your queries and actually displaying errors. MySQL errors must be handled and displayed by your PHP, since SQL is a separate language run on a separate server.

  4. The "menukey" you see in your query string is...the menukey from the query string. The query string is the last bit of the URL.

     

    If you need to pass multiple variables in a query string, you separate them with an ampersand:

    yourfile.php?menukey=8&page=3

  5. yes but if he is using in a same domain it will work in a 2 different domains it will be hard though.

    If it's two pages on the same website, then yes it will work. Two separate sites (domains) will never work

     

     

    what about create a 2 different session name then store the value in those 2 session so if the user access the other site it will automatically login,
    What?
  6. Are they on the same server? If they are, and they are under different subdomains or domains, you'll have to set the session cookie domain to be the same in both projects.

    If you set the session cookie domain to be different than the domain of the site, it won't work.

     

    We did it using $_GET vars and a whole lot of validating. Seems to work ok.

    Dangerous for a public web app, GET vars can be intercepted, bookmarked, and accidentally emailed/IMed.
  7. :: has nothing to do with namespacing, that stack overflow article is talking about an entirely different language.

     

    parent:: is a special construct in PHP that refers to the class which the current class extends. parent::foo() calls the function foo on the parent, and parent::__construct() calls the parent's constructor. Normally the :: operator indicates that a function is being called statically, but for parent:: it can be static or dynamic.

     

    The usage for parent::__construct() inside the child constructor is to ensure that the object you get back is the child, but the code for the constructor in the parent is still run. It's not actually necessary to have a child constructor with nothing but parent::__construct() in it, but some people like to be explicit, and usually there's at least one other activity in the child constructor before the parent's is called.

  8. Why do you need more than 10 decimal places in your database? At some point, you have to be reasonable. There are some fractions which cannot be represented as decimals, and some repeating decimals which are very difficult to detect.

     

    Functions like the one you were given only solve a subset of the problem. It doesn't handle x/5, x/7, x/11, or x/13, and those are just the primes below 16 (its max)

  9. echo $testUserName = $ifNewUserName[$ifNameAlreadyExsist]+;

     

    Because PHP lines cannot end in a plus, the semicolon is unexpected.

     

     

    $ifExsist = "SELECT COUNT( player_id ) FROM players WHERE player_id LIKE '$newUserName[0-9]'";

     

    This line is valid, perhaps there's lines above it which are causing issues.

  10. I made absolutely NO changes to it what-so-ever, the only thing I did was change the hosting company I am with.
    You did absolutely nothing to it but change the entire execution environment, PHP.ini, the web server version, the web server config, and possibly the PHP version.

     

    It's like reformatting your computer. Things change when you do that.

×
×
  • 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.