SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: syntax error.

  1. #1
    SitePoint Member
    Join Date
    Apr 2013
    Location
    Sydney
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    syntax error.

    Hi there,
    I can't find where I made a mistake, for years...
    PHP Code:
    $row "INSERT INTO Student (Name, Surename, StudentID, Generation) VALUES ('$_POST[$student_data[0]]', '$_POST[$student_data[1]]', '$_POST[$student_data[2]]', '$_POST[$student_data[3]]')"
    This is report: Parse error: syntax error, unexpected '[', expecting ']' in
    Thanks in advance...

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,218
    Mentioned
    153 Post(s)
    Tagged
    0 Thread(s)
    First how are you defining $student_data?
    Second, put var_dump($_POST); in your code and see what PHP is receiving from your form.

  3. #3
    SitePoint Member
    Join Date
    May 2013
    Location
    Prague, Czech Republic
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm... Maybe you should to replace $_POST[$student_data[N]] with $_POST[$student_data][N] ?


Tags for this Thread

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
  •