Jump to content

ManiacDan

Staff Alumni
  • Posts

    2,604
  • Joined

  • Last visited

  • Days Won

    10

Posts posted by ManiacDan

  1. I've moved you to the "website critiques" section.

     

    Do you not have this project running anywhere? Very few people will open and run an anonymous zip file full of code.

     

    What parts are they saying isn't very good? Maybe post a representative sample in the thread here

  2. My query:

     

    ON DUPLICATE KEY UPDATE `voted` = `voted` + VALUES(`voted`), `total` = `total` + VALUES(`total`);

     

     

    Your query:

     

     

    ON DUPLICATE KEY UPDATE `voted` = $addedtogether + VALUES(`voted`), `total` = 30 + VALUES(`total`)";

     

     

    You swapped things. I had `total` and you have 30. I had `voted` and you had $addedtogether.

     

  3. What a weird system.

     

    So you want:

    INSERT INTO `survey` (`username`, `voted`, `total`)
    VALUES ('maniacdan', '5', '10')
    ON DUPLICATE KEY UPDATE `voted` = `voted` + VALUES(`voted`), `total` = `total` + VALUES(`total`);

     

    Your original problem definition was missing a question ID.

  4. Most of us belong to the other forums too.

     

    Speaking of the world inventing teachers, I asked you a question: what was confusing? If you want us to do more than show you the page with the exact answer you want, explain why you couldn't find the answer even when given the manual entry.

     

     

  5. You really honestly spent three hours reading the date() manual page? There's examples and everything. What part was confusing? You were given a fishing rod and a book on fishing and pointed toward the nearest body of water.

     

    We didn't point you to google, we pointed you to the document on how to do what you asked. The manual. Read it. Get the t-shirt

  6. You want the word "December"?

     

    1) Open up the page

     

    2) Ctrl+F

     

    3) Type "December"

     

    4) Find this row:

    F             A full textual representation of a month, such as January or March              January through December

     

    5) Use it inside the first argument to date: date('F');

     

    6) ???

     

    7) Get spoon fed the answer

  7. Then stop helping him so he can go somewhere else. I don't understand the people who say:

    I know we've had this before but I really cant see the point of a forum that tells you to go somewhere else.
    while simultaneously ignoring everything we say.

     

    This code is a random slapping together of disparate elements with no consistent style, random indentation, invalid SQL syntax, strings that exist for no reason as bare non-operations, poor concatenation, no security, and will never improve from us simply repeating good advice over and over.

     

    Stop what you're doing. Start this section of code over. Turn on error reporting. Handle your SQL errors. In fact, do this:

     

    $result = mysql_query( $sql );
    if ( $result === false ) {
     die("Fatal SQL error for: {$sql}<P />MySQL Server returned: <br />" . mysql_error());
    }

    If you use mysql_query anywhere else but in that exact block we can't help you. Copy and paste that. Copy and paste this as well:

    error_reporting(E_ALL);

    Error_reporting should be the very first line in your script.

  8. The bug in reply #10 was a missing comma. I got too annoyed reading the thread to see if I'm the first person to spot it.

     

    Edit: Holy crap turn on error_reporting. Reply #31 would throw at least 6 PHP errors.

  9. How do you expect the database to know what a duplicate is? You need to create a UNIQUE index on the table so the database can actually define the word "duplicate"

     

    Also, oauth UUIDs are usually alphanumeric, you don't quote yours.

     

    You also have your quotes wrong, inside "quotes variables are {$likeThis}, not ${likeThat}"

  10. How do I get it to seperate city and state.
    Remember when someone asked you...

     

     

     

    In another note, do you want the count only by city (no matter the state) or the count by the pair city-state?... if the last case is what you want you must GROUP BY city AND state
    You've also added count(state) which is unnecessary, get rid of it.

     

    Your new query:

     

    $query = mysql_query("SELECT state, city, count(city) as num FROM needs WHERE status='posted' GROUP BY state, city ORDER BY state, city");

     

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