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

  • SEARCH
  • Home
  • 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 7444565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:32:26+00:00 2026-05-29T11:32:26+00:00

I am trying to add another varable where on doesn’t exist. It is a

  • 0

I am trying to add another varable where on doesn’t exist. It is a posting app where you enter 2 text boxes and it is posted. It originally came with one variable with for the body. i wanted to add body1 to it as well. The functions.php deifines the first one upon adding the second, I got this:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/a1893806/public_html/functions.php on line 20 Here is the modified code:

<?php

function add_post($userid,$body,$body1){
    $sql = "insert into posts (user_id, body, body1, stamp) 
            values ($userid, '". mysql_real_escape_string($body,$body1). "',now())";

    $result = mysql_query($sql);
}
function show_posts($userid){
    $posts = array();

    $sql = "select body, stamp from posts
     where user_id = '$userid' order by stamp desc";
    $result = mysql_query($sql);

    while($data = mysql_fetch_object($result)){
        $posts[] = array(   'stamp' => $data->stamp, 
                            'userid' => $userid, 
                            'body' => $data->body
                            'body1' => $data->body1
            );
    }
    return $posts;

}
?>

It originally doesn’t have: 'body1' => $data->body1 or any of the body1 variables

I’m not sure why I can’t have the 2 textboxes in the post.

  • 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-05-29T11:32:27+00:00Added an answer on May 29, 2026 at 11:32 am

    You have 2 tables inside each other:

    <table class="imagetable">
    <table align="center" border='0' cellspacing='0' cellpadding='5' width='300'>
    

    This is not allowed.

    function add_post($userid,$body,$body1){
        $sql = "insert into posts (user_id, body, body1, stamp) 
            values ($userid, '". mysql_real_escape_string($body,$body1). "',now())";
    
        $result = mysql_query($sql);
    }
    

    Must be

    function add_post($userid,$body,$body1){
        $sql = "
           INSERT into posts (user_id, body, body1, stamp) 
            VALUE (".$userid.", '". mysql_real_escape_string($body) ."', '".mysql_real_escape_string($body1). "', NOW())";
    
        $result = mysql_query($sql);
    }
    

    And I personally prefer this for readability:

        $sql = "
           INSERT into posts
              SET user_id = ".$userid."
                , body = '". mysql_real_escape_string($body) ."'
                , body1 = '".mysql_real_escape_string($body1). "'
                , stamp = NOW()
    

    Something more trivial; body1 doesn’t make much sense.. 1; it is actually number 2. 2; Why would you have 2 body’s? Makes no sense? Maybe body should be intro and body1: body? (I know it’s not too important, but makes it easier to understand)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add a pojo to a collection in another pojo. I'm sure
I am trying to insert a div inside another div using add() of jquery
Trying to add email notification to my app in the cleanest way possible. When
I have a method and I am trying to add another method as a
I am trying to figure out how to add another string to my month
I am trying to send a simple get to another page, and it doesn't
I am trying to read a text file in C# and add line numbers
I'm trying add a tab to my web page that looks like this: Using
Trying to add an onclick handler to my tabs, and can't seem to get
trying to add an ExpiresDefault ExpiresByType to content on my website so that way

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.