SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2006
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question code not working

    Output:

    Error adding : 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 '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30' at line 1

    code:

    PHP Code:
    $rating1 $_POST['rating1'];
        
    $rating2 $_POST['rating2'];
        
    $rating3 $_POST['rating3'];
        
    $rating4 $_POST['rating4'];
        
    $rating5 $_POST['rating5'];
        
    $rating6 $_POST['rating6'];
        
    $rating7 $_POST['rating7'];
        
    $rating8 $_POST['rating8'];
        
    $rating9 $_POST['rating9'];
        
    $rating10 $_POST['rating10'];
        
    $rating11 $_POST['rating11'];
        
    $rating12 $_POST['rating12'];
        
    $rating13 $_POST['rating13'];
        
    $rating14 $_POST['rating14'];
        
    $rating15 $_POST['rating15'];
        
    $rating16 $_POST['rating16'];
        
    $rating17 $_POST['rating17'];
        
    $rating18 $_POST['rating18'];
        
    $rating19 $_POST['rating19'];
        
    $rating20 $_POST['rating20'];
        
    $rating21 $_POST['rating21'];
        
    $region22 $_POST['region22'];
        
    $rating23 $_POST['rating23'];
        
    $rating24 $_POST['rating24'];
        
    $rating25 $_POST['rating25'];
        
    $rating26 $_POST['rating26'];
        
    $rating27 $_POST['rating27'];
        
    $rating28 $_POST['rating28'];
        
    $rating29 $_POST['rating29'];
        
    $rating30 $_POST['rating30'];
        
    $rating31 $_POST['rating31'];
        
    $rating32 $_POST['rating32'];
        
    $rating33 $_POST['rating33'];
        
    $rating34 $_POST['rating34'];
        
    $rating35 $_POST['rating35'];
        
    $rating36 $_POST['rating36'];
          
    $sql "INSERT INTO phil_inv(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36) VALUES( 
                  '
    $rating1',
                  '"
    .$rating2."',
                  '"
    .$rating3."',
                  '"
    .$rating4."',
                  '"
    .$rating5."',
                  '"
    .$rating6."',
                  '"
    .$rating7."',
                  '"
    .$rating8."',
                  '"
    .$rating9."',
                  '"
    .$rating10."',
                  '"
    .$rating11."',
                  '"
    .$rating12."',
                  '"
    .$rating13."',
                  '"
    .$rating14."',
                  '"
    .$rating15."',
                  '"
    .$rating16."',
                  '"
    .$rating17."',
                  '"
    .$rating18."',
                  '"
    .$rating19."',
                  '"
    .$rating20."',
                  '"
    .$rating21."',
                  '"
    .$rating22."',
                  '"
    .$rating23."',
                  '"
    .$rating24."',
                  '"
    .$rating25."',
                  '"
    .$rating26."',
                  '"
    .$rating27."',
                  '"
    .$rating28."',
                  '"
    .$rating29."',
                  '"
    .$rating30."',
                  '"
    .$rating31."',
                  '"
    .$rating32."',
                  '"
    .$rating33."',
                  '"
    .$rating34."',
                  '"
    .$rating35."',
                  '"
    .$rating36."'
                  )"

    Thanks.

  2. #2
    SitePoint Enthusiast
    Join Date
    Oct 2006
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OMG!

    hmm ok, have u tried arrays?

    And can you echo the final query and paste it here?

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2006
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1) I have not tried arrays yet. I am new to PHP. I am going to try it now and will get back to you.

    2) at the end of my code, there is this script:
    PHP Code:
          if (@mysql_query($sql)) { 
            echo(
    "<P>Your ratings has been 
    added.</P>"
    ); 
          } else { 
            echo(
    "<P>Error adding : " 

                 
    mysql_error() . "</P>"); 
          } 
    But program is not going that far...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •