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.
You have 2 tables inside each other:
This is not allowed.
Must be
And I personally prefer this for readability:
Something more trivial;
body1doesn’t make much sense.. 1; it is actually number 2. 2; Why would you have 2 body’s? Makes no sense? Maybebodyshould beintroandbody1:body? (I know it’s not too important, but makes it easier to understand)