Jump to content

ManiacDan

Staff Alumni
  • Posts

    2,604
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by ManiacDan

  1. I think even a non-numeric string will throw an error, since these lower-level c functions tend to be strict.
  2. The second argument to mysql_result is a number. It must be a number. You originally had the string '$roomnumber'. Are you saying that once you actually use the variable $roomnumber it's giving the same error? Try intval($roomnumber).
  3. Wikipedia is PHP without any custom back-end, to my knowledge. Drupal, wordpress, etc. Most of the web is PHP.
  4. Good work team, looks like we got it figured out.
  5. 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.
  6. That's not how sessions work, at all. $_SESSION is completely different between two sites. They are not shared.
  7. 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) 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.
  8. What Pika said too. There's at least 3 mysql errors in your query.
  9. 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.
  10. Nothing in code happens "automatically," you can't just add "page=2" to your code and expect it to display the second page, you actually have to write code which processed $_GET['page']. Did you do that?
  11. 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
  12. If it's two pages on the same website, then yes it will work. Two separate sites (domains) will never work What?
  13. If you set the session cookie domain to be different than the domain of the site, it won't work. Dangerous for a public web app, GET vars can be intercepted, bookmarked, and accidentally emailed/IMed.
  14. If the web apps are on different URLs, John's solution won't work. You can use some sort of oauth or saml code to allow your sites to share login information. It's difficult to allow two different domains to share a login.
  15. If that was the only change you needed, your classes is YEARS behind modern PHP and you shouldn't be learning from this person, bone-throwing or not.
  16. :: 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.
  17. mysql_real_escape_string. Use it on every single string input.
  18. 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)
  19. Well that's your first problem, don't use tables for layout. For one, tables don't float. Divs, on the other hand, float just fine.
  20. Nice catch Kicken.
  21. 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.
  22. Where did you even find a web host which would voluntarily give you a version of PHP which was FOURTEEN YEARS OLD?
  23. 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.
  24. Yeah...what's the actual problem here?
  25. Re-setting the variables with sessions is also good, but note that it will screw up your pages if someone has two tabs open to your site. Each new tab will steal and overwrite rankings from the other tabs unless you make unique session arrays for each table you're displaying.
×
×
  • 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.