Search results

  1. M

    Backup script for freehosting

    Enough with the contentless posts. If you guys want to thank someone, click the "Like" link on the post. Otherwise, it's just noise.
  2. M

    php/mysql update

    That's not enough information to understand your problem. Please provide minimal sample code; for SQL questions, this would be the table schema (CREATE TABE statements), along with sample data (as INSERT ... VALUES statements) and desired results (which don't need to be code, as they are the...
  3. M

    Access denied to mysql database

    The script is trying to connect without a password somewhere. Perhaps another mysql function is being called before mysql_connect, which will attempt to connect with default parameters. This is one reason the connection should always be specified when calling the mysql functions. The mysql...
  4. M

    Help with php and mysql

    A few similarities, I suppose. More similar than either to a Lisp or even Smalltalk, but between C++'s static typing, multiple inheritance, overloading for functions & operators, templates, separation of interfaces (in headers) and implementations, STL and PHP's type hints, single inheritance...
  5. M

    Javascript Highscore Table

    That's fairly common, especially among neophyte programmers. It happens to experienced developers who suffer from NIH. Instead of document.write, you can use the the DOM methods, such as document.createElement. See the showScores function in my previous sample, which also lets you put the...
  6. M

    Problem with $_POST in PHP

    It's probably because so many neophyte developers are completely oblivious to SQL injection, and magic quotes provide at least a small measure of protection for X10's servers. IMO, the registration Turing test should be replaced with something about SQL injection, so X10 can be fairly sure the...
  7. M

    Why doesn't this save to my mysql file? (PHP)

    See my previous post(s), which also cover other generic mistakes that happen to appear in the sample code in this thread. The key is to use prepared statements (and an extension that supports them). One issue that I haven't covered in your code (but have in many other threads on these forums)...
  8. M

    Help with a mysql database, how to reset a "unique" id to 1.

    You can also use ALTER TABLE: ALTER TABLE `table` AUTO_INCREMENT=1; The same statement can be used to change any of the table options. For example: ALTER TABLE `table` Engine=InnoDB; ALTER TABLE `table` Comment='A comment';
  9. M

    Javascript Highscore Table

    The bulk of getscores is unnecessary. There are already a number of formats for data interchange, such as JSON. var highscores = [ {score: 100, name: "tommy", /* You want floats? We got floats: */ time: 42.14}, ... ]; // to save or send the high scores elsewhere, first convert...
  10. M

    Problem with php. Connecting to a database. Easy fix?

    A new thread would be better to keep the scope of each more specific. For one thing, someone searching for a solution to one problem won't be interested in the other problems; they'll just be noise. Don't use die when outputting HTML. You'll get invalid HTML. Instead of using print, echo...
  11. M

    need help in PHP coding - double header not working if used twice??

    That's hardly a minimal test case. Read the link in my previous post (it's there for a reason). That's likely not URL for a resource on your server. URLs are absolute, in which case they begin with a scheme (e.g. "http:"), or are relative, which is a path relative to the current URL (if...
  12. M

    Help with php and mysql

    Was it W3Schools, by any chance?
  13. M

    Help with php and mysql

    PHP converts undefined constants to strings, so localhost will become "localhost". However, never rely on this as it can lead to subtle bugs and will likely be dropped in the future. If you're not familiar with this feature, you should read through the PHP language reference or find a good book...
  14. M

    htaccess help

    Sample code is good, but you haven't clearly stated the problem. Always explicitly state what you want and what you have. Short code samples should be placed in the post, in case the linked site ever goes down or the page gets edited, so that people with the same problem can resolve it by...
  15. M

    Help help! Need help!

    When asking for help: Use meaningful, specific subject headers Please use [php], [html] or [code] tags (as appropriate) to separate and format code. Say what you expect to happen and what actually happens, including any error messages. Make sure you follow these instructions, as well as...
  16. M

    Login script

    I just noticed another issue: it uses rand for cryptographic purposes, such as nonce generation (note: the statistical problems of rand aren't as obvious on Linux as they are on MS Windows, but they're still there). Under PHP, about the only cryptographically decent pseudo-random generator is...
  17. M

    Need help with "background-color" property in CSS

    Indeed, following up with the solution is a mitzvah. The post could perhaps have used a clarifying note that the problem was resolved and the code was the solution, but Debojyoti Ghosh did a much better job than many, overall.
  18. M

    need help in PHP coding - double header not working if used twice??

    That's not enough information to reproduce the problem. Create a minimal test case, post the code here and include a link to a live version of the minimal test case. For more on the syntax of the "Location" header, check the current HTTP standard. Note that though the standard calls for an...
  19. M

    MDB2 Syntax Error

    null is a perfectly valid value for the $where argument. The documentation for autoExecute even uses null. Note the date of the first post. Don't revive dead threads.
  20. M

    Backup script for freehosting

    The recursion can also be handled by the SPL classes RecursiveDirectoryIterator and RecursiveIteratorIterator. function copy_r($path, $destination) { # ensure paths end in "/" $path = preg_replace('%/?$%', '/', $path); $destination = preg_replace('%/?$%', '/', $destination)...
Top