Jump to content

cpd

Members
  • Posts

    883
  • Joined

  • Last visited

  • Days Won

    5

Posts posted by cpd

  1. Ive got a line of SQL that will input a row into my table and the information is correct as far as im away. Ive re-written the line a few times and the same error occurs saying

     

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key,pilotid,name,email,country,dob,password,simulator,hub,vatsimid,ivaoid,hours,' at line 1

     

    The line that involves "'key,pilotid,name,email,country,dob,password,simulator,hub,vatsimid,ivaoid,hours,' " is:

     

        mysql_query("INSERT INTO `users` (joined,key,pilotid,name,email,country,dob,password,simulator,hub,vatsimid,ivaoid,hours,proof,comments,code,activated) VALUES ('$date','n','$pilotid','$name','$email','$country','$dob','$password','$simulator','$hub','$vatsimid','$ivaoid','$hours','$proof','$comments','$code','n')")or die(mysql_error());
    

     

    At least thats what im led to believe however i cant undersatnd why it refers to line 1.

     

    What does the error mean and how do i correct it?

  2. Baisically, i have made my biggest script ever for inputting into a database etc etc. I keep getting the petty error of

     

    Parse error: syntax error, unexpected ';' in C:\xampp\htdocs\c9\careers\sendmapplication.php on line 37

     

    After many hours of staring point blank at the same lines of code im offering it to someone to see if they can spot the mistake coz i DEFINATELY cant.

     

        } elseif($_POST['email'] != $_POST['cemail']) {
          header('location: ../index.php?content=join&error=The+emails+were+not+the+same&mname='.$_POST['name'].'&mpilotid='.$_POST['pilotid'].'&memail='.$_POST['email'].'&mcemail='.$_GET['cemail'].'&mpassword='.$_POST['password'].'&mcpassword='.$_POST['cpassword'].'&mvatsimid='.$_POST['vatsimid'].'&mivaoid='.$_POST['ivaoid'].'&mhours='.$_POST['hours'].'&mproof='.$_POST['proof'].'&mjob='.$_POST['job'].'&msuitjob='.$_POST['suitjob'].'&mwhatcan='.$_POST['whatcan'].'&mcomments='.$_POST['comments']);
        } elseif($_POST['password'] != $_POST['cpassword']) {
          header('location: ../index.php?content=join&error=The+passwords+were+not+the+same&mname='.$_POST['name'].'&mpilotid='.$_POST['pilotid'].'&memail='.$_POST['email'].'&mcemail='.$_GET['cemail'].'&mpassword='.$_POST['password'].'&mcpassword='.$_POST['cpassword'].'&mvatsimid='.$_POST['vatsimid'].'&mivaoid='.$_POST['ivaoid'].'&mhours='.$_POST['hours'].'&mproof='.$_POST['proof'].'&mjob='.$_POST['job'].'&msuitjob='.$_POST['suitjob'].'&mwhatcan='.$_POST['whatcan'].'&mcomments='.$_POST['comments']);
        } else {
          
    

     

    That is lines 34 through to 39...

     

    If someone can spot it after like less then 2 mins of look at it...im amazed.

  3. Ignoreing all the information and things im trying to input into the database (Its for a Flight Simulator Website), could somebody please tell me why this query wont submit. When it is submited NO errors are returned therefore i presume the query has been sent however when i look in the database there is NOTHING.

     

        mysql_query("INSERT INTO `users` (joined,pilotid,name,email,country,dob,password,simulator,hub,vatsimid,ivaoid,hours,proof,comments,code,activeated) VALUES ('$date','$pilotid','$name','$email','$country','$dob','$password','$simulator','$hub','$vatsimid','$ivaoid','$hours','$code','n')");
    

     

    And just incase anybody says something about "Have i defined all the variables" your answer is yes i have but that wouldnt make any difference anyway. If i had defined them incorrectly the value thats input would be NULL.

    Cheers in advance ;)

  4. The situation is this.

     

    I have made a registration script whereby it automatically (Using Auto Inc) assigns an ID to the person that is registering. I also want to assign and ID that is 4 Chars long.

     

    My aim is to get the last entry to the table and get that ID that i have assigned (First value is 1111) and add 1 to it so that the next one is 1112 etc etc.

     

    In order to do this i came up with:

     

      $qry = mysql_query("SELECT * FROM `users` WHERE `key` = 'n' AND `key` = 'a' ORDER BY `user_id` DESC LIMIT 1");
      $qry_r = mysql_fetch_assoc($qry);
      
      $newid = $qry_r['id'] + 1;
    

     

    I would have obviously connected up to the database etc etc. Now, ive made a "Key" column that contains one of two letters, a or n. Regardless of whats in the key ive told it to select all rows as its got "key = 'a' AND key = 'n'". In addition ive told it to order but the user_id (This is autoincrement) and then told it to get the last row by saying "DESC LIMIT 1". In other words it should be selecting the last row? (Is that right?)...

     

    The column is set to Integer and with a max of 11 which is default.

     

    The problem thats occuring is that it doesnt add one so i can input it into the next users, infact: it doesnt even select the id of the last row that ive assigned by simply typeing the first one in which was 1111. Therfore, it should just continue with + 1...1112...+1....1113 etc etc

     

    Can anyone suggest why and better yet offer an AMAZING solution that will do the job. Much appreciated!

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