Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7950441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:16:24+00:00 2026-06-04T02:16:24+00:00

UPDATE: Thank you all so much for your help on this. I’ve taken a

  • 0

UPDATE:

Thank you all so much for your help on this. I’ve taken a different tack and decided
to use just one table.


I have a database set up consisting of 3 tables. I have three short forms and I want to use the same add_player.php to write the form data to the database.

Depending on which form is submitted (I have a hidden field defining form_id in each form), data would get written to one of three tables: ff_offense, ff_kicker, ff_defense.

I am getting an unexpected } error. I know my syntax is off, but I’m not well versed enough in PHP to be able to spot the culprit. Here is the code of add_player.php:

<?php
$con = mysql_connect("localhost","dariia","celtic03");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("football", $con);

if($form_id ="offense") {$query="INSERT INTO ff_offense (ID, PLAYER, POSITION, TEAM, PASS_YDS, RUSH_YDS, REC_YDS, RECEPTIONS, TD) 
    VALUES ('NULL','$_POST[PLAYER]','$_POST[POSITION]','$_POST[TEAM]','$_POST[PASS_YDS]','$_POST[RUSH_YDS]','$_POST[REC_YDS]','$_POST[RECEPTIONS]','$_POST[TD]')"}

    elseif($form_id="kicker") {$query="INSERT INTO ff_kicker {K_ID, K_PLAYER, K_TEAM, K_EXTRA_PTS, K_FG)
        VALUES ('NULL','$_POST[K_PLAYER]','$_POST[K_TEAM]','$_POST[K_EXTRA_PTS]','$_POST[K_FG]')"}

    elseif($form_id="defense")  { $query= "INSERT INTO ff_defense {D_ID, D_TEAM, D_SACKS, D_INT, D_TD}
        VALUES ('NULL','$_POST[D_TEAM]','$_POST[D_SACKS]','$_POST[D_INT]','$_POST[D_TD]')"} ;

$db->setQuery($query);
$db->query();   

if (!mysql_query($query,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "1 record added";

mysql_close($con);
?>

The error was for line 11, which would be VALUES line for if($form_id="offense").

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T02:16:25+00:00Added an answer on June 4, 2026 at 2:16 am

    Looks like you are missing some semi-colons after your strings as well.

    if($form_id == "offense") {
        $query="INSERT INTO ff_offense (ID, PLAYER, POSITION, TEAM, PASS_YDS, RUSH_YDS, REC_YDS, RECEPTIONS, TD) 
        VALUES ('NULL','$_POST[PLAYER]','$_POST[POSITION]','$_POST[TEAM]','$_POST[PASS_YDS]','$_POST[RUSH_YDS]','$_POST[REC_YDS]','$_POST[RECEPTIONS]','$_POST[TD]')";
    } elseif($form_id=="kicker") {
        $query="INSERT INTO ff_kicker {K_ID, K_PLAYER, K_TEAM, K_EXTRA_PTS, K_FG)
            VALUES ('NULL','$_POST[K_PLAYER]','$_POST[K_TEAM]','$_POST[K_EXTRA_PTS]','$_POST[K_FG]')";
    } elseif($form_id=="defense")  { 
        $query= "INSERT INTO ff_defense {D_ID, D_TEAM, D_SACKS, D_INT, D_TD}
            VALUES ('NULL','$_POST[D_TEAM]','$_POST[D_SACKS]','$_POST[D_INT]','$_POST[D_TD]')";
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

UPDATE : Thank you all who tried to help. I appreciate your time. As
UPDATE 2: Thanks so much for all your help. While all three solutions worked,
UPDATE: In trying to replicate this problem one more time to answer your questions
UPDATE: So pretty much everyone here has told me that I just need to
Update Thanks to Marc's help the AlphaPagedList class is now available on CodePlex if
Update I don't think I was clear enough when I originally posted this quesion.
UPDATE: Solved. Thanks BusyMark! EDIT: This is revised based on the answer below from
This SQL statement example is very close to what I think I need... update
Ok, let's see if this all makes sense. Today, as I began working on
We have a security problem here and we really need your help and inputs.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.