www.webdeveloper.com
Results 1 to 5 of 5

Thread: help - error message

  1. #1
    Join Date
    Sep 2006
    Posts
    2

    help - error message

    i am getting this

    Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ']' on line 23

    here is some of php:


    if(isset($_POST[s1]))
    {
    $MyExp = mktime(0,0,0,date(m) + 1, date(d), date(Y));

    $q1 = "insert into agents set
    username = '$_POST[NewUsername]',
    AccountType = '$_POST[AccountType]',
    type='$_POST[type]',
    password = '$_POST[p1]',
    FirstName = '$_POST[FirstName]',
    LastName = '$_POST[LastName]',
    resume = '$_POST[resume]',
    phone = '$_POST[phone]',
    cellular = '$_POST[cellular]',
    pager = '$_POST[pager]',
    ResumeImages = '$ImageStr',
    email = '$_POST[email]',



    RegDate = '$t',
    ExpDate = '$MyExp',
    AccountStatus = 'active',
    offers = '0' ";

    mysql_query($q1);


    please help - i am going crazy here

  2. #2
    Join Date
    Jul 2006
    Location
    Nebraska
    Posts
    380
    First of all, use code tags, they make life easier to read. I think your query is a little buggy, don't you want something like this?
    PHP Code:
    if(isset($_POST[s1]))
    {
    $MyExp mktime(0,0,0,date(m) + 1date(d), date(Y));

    $q1 "
        INSERT INTO agents
        (username, AccountType, type, password, FirstName, LastName, resume, phone, cellular, pager, ResumeImages, email, RegDate, ExpDate, AccountStatus, offers)
        VALUES
        ('
    $_POST[NewUsername]', '$_POST[AccountType]', '$_POST[type]', '$_POST[p1]', '$_POST[FirstName]', '$_POST[LastName]', '$_POST[resume]', '$_POST[phone]', '$_POST[cellular]', '$_POST[pager]', '$ImageStr', '$_POST[email]', '$t', '$MyExp', 'active', '0')
    "
    ;
    mysql_query($q1); 
    Also, which line is line 23 here?
    My Site
    Web Design On Linux: Sure It Takes Longer To Get It Right In IE, But Who Really Cares?

  3. #3
    Join Date
    Sep 2006
    Posts
    2

    great - more help

    great - thanks, that works - what i was trying to do when i got this mess was put another input field - something where they have to give a referral email address - can you help with this too ----- thank you so much

  4. #4
    Join Date
    Jul 2006
    Location
    Nebraska
    Posts
    380
    sure thing, just add it into the database, then into the form
    HTML Code:
    <input type="text" name="referralEmail" />
    and then into the query
    Code:
    $q1 = "
        INSERT INTO agents
        (username, AccountType, type, password, FirstName,
         LastName, resume, phone, cellular, pager, ResumeImages,
         email, RegDate, ExpDate, AccountStatus,
         offers, referralEmail)
        VALUES
        ('$_POST[NewUsername]', '$_POST[AccountType]', '$_POST[type]',
         '$_POST[p1]', '$_POST[FirstName]', '$_POST[LastName]',
         '$_POST[resume]', '$_POST[phone]', '$_POST[cellular]',
         '$_POST[pager]', '$ImageStr', '$_POST[email]', '$t', '$MyExp',
         'active', '0','$_POST[referralEmail]')
    ";
    My Site
    Web Design On Linux: Sure It Takes Longer To Get It Right In IE, But Who Really Cares?

  5. #5
    Join Date
    Jul 2006
    Location
    Nebraska
    Posts
    380
    You also might want to clean up those inputs. If your PHP install doesn't have magic quotes on, then a malicious user could mess up your table, maybe even drop it with all it's data.
    My Site
    Web Design On Linux: Sure It Takes Longer To Get It Right In IE, But Who Really Cares?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles