Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING o

please i am having this
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING ,
i have gone through the common mistakes but couldnt detect the error please


<?php require_once("include/dataconnect.php");?>
<?php require_once("include/functions.php");?>
<?
 $items = $_POST['item'];
foreach ($items as $item) {
     list($Pquantity, $Pidno) = $item;
     }
     if('POST' === $_SERVER['REQUEST_METHOD'])
     {
		$queryreg = mysql_query("
 		UPDATE repplac SET Pquantity = $Pquantity WHERE Pidno = $Pidno AND username = $_SESSION['username']")
		}
		$emails=mysql_query("SELECT reusers.email
FROM reusers, wishlist
WHERE reusers.username = wishlist.Uname")or die(mysql_error());
$results = (mysql_fetch_assoc($emails)) or die(mysql_error());
$email= $results{'email'};

$pplresult = mysql_query("SELECT * FROM repplac");
$list = $row['Sname'] .$row['Pname'] .$row['Psize'] .$row['Pcolour'] .$row['Pquantity'] .$row['Price'];
while($row = mysql_fetch_assoc($pplresult)){
$list .= $row['Sname'] .$row['Pname'] .$row['Psize'] .$row['Pcolour'] .$row['Pquantity'] .$row['Price']."\
";}



 $to = $email;
       $subject = "YOUR ORDER LIST FROM REACHEASY";
       $headers = "From: donotreply@rapsody.co.uk";
	   $body = "$list";

       mail($to,$subject,$body,$headers);
$transfer = mysql_query("INSERT INTO wishlist SELECT  * FROM repplac")or die(mysql_error());
$deletetable = mysql_query("DELETE FROM repplac")or die(mysql_error());
redirect_to('youraccount.php');

		?>

Commenting and indenting can help when code isn’t clear. There were a few errors in the above code and a few logical mistakes, but I think the following should work the way you wanted it to:

<?php
require_once("include/dataconnect.php"); 
require_once("include/functions.php"); 
if(array_key_exists('item', $_POST)){
    $items = $_POST['item'];
    //Loop through $_POST items, updating the database for each item
    foreach ($items as $item) { 
        $Pquantity = intval($item[0]);
        $Pidno = intval($item[1]); 
        $queryreg = mysql_query("
            UPDATE repplac
                 SET Pquantity = {$Pquantity}
                 WHERE
                       Pidno = {$Pidno}
                 AND
                       username = '{$_SESSION['username']}'
        "); 
    }
    //Get Email Address
    $emails = mysql_query("SELECT reusers.email FROM reusers INNER JOIN wishlist ON reusers.username = wishlist.Uname AND reusers.username = '{$_SESSION['username']}'")or die(mysql_error()); 
    $email = mysql_result($emails, 0);
    
    //Get list to email user
    $list = '';
    $pplresult = mysql_query("SELECT * FROM repplac");   
    while($row = mysql_fetch_assoc($pplresult)){ 
        $list .= $row['Sname'] .$row['Pname'] .$row['Psize'] .$row['Pcolour'] .$row['Pquantity'] .$row['Price']."\
"; 
    }
    
    //Send email
    $to = $email; 
    $subject = "YOUR ORDER LIST FROM REACHEASY"; 
    $headers = "From: donotreply@rapsody.co.uk"; 
    $body = "$list"; 
    mail($to,$subject,$body,$headers);
    
    //Transfer records to wishlist 
    $transfer = mysql_query("INSERT INTO wishlist (SELECT  * FROM repplac WHERE username = '{$_SESSION['username']}')");
    // Delete temporary records if the above query was successful:
    if($transfer !== false){
        $deletetable = mysql_query("DELETE FROM repplac WHERE username = '{$_SESSION['username']}'");
    }
}     
redirect_to('youraccount.php'); 
?>

You had some whole-table emptying going on, but you only want to be removing records allocated to that particular user, so I’ve fixed that. Give it a go, I haven’t verified if there’s an error or not but it should be fine.

its giving this error
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 5 in /home/reachea2/public_html/updatepplac.php on line 21

Warning: Cannot modify header information - headers already sent by (output started at /home/reachea2/public_html/updatepplac.php:21) in /home/reachea2/public_html/include/functions.php on line 5

The second error is ok (kind of), it’s basically an error produced by the mysql row. I should have caught that one:

<?php
require_once("include/dataconnect.php"); 
require_once("include/functions.php"); 
if(array_key_exists('item', $_POST)){
    $items = $_POST['item'];
    //Loop through $_POST items, updating the database for each item
    foreach ($items as $item) { 
        $Pquantity = intval($item[0]);
        $Pidno = intval($item[1]); 
        $queryreg = mysql_query("
            UPDATE repplac
                 SET Pquantity = {$Pquantity}
                 WHERE
                       Pidno = {$Pidno}
                 AND
                       username = '{$_SESSION['username']}'
        "); 
    }
    //Get Email Address
    $emails = mysql_query("SELECT reusers.email FROM reusers INNER JOIN wishlist ON reusers.username = wishlist.Uname AND reusers.username = '{$_SESSION['username']}'")or die(mysql_error());
    if(mysql_num_rows($emails) == 0){
         exit("No email addresses found for user '{$_SESSION['username']}'");
    }
    $email = mysql_result($emails, 0);
    
    //Get list to email user
    $list = '';
    $pplresult = mysql_query("SELECT * FROM repplac");   
    while($row = mysql_fetch_assoc($pplresult)){ 
        $list .= $row['Sname'] .$row['Pname'] .$row['Psize'] .$row['Pcolour'] .$row['Pquantity'] .$row['Price']."\
"; 
    }
    
    //Send email
    $to = $email; 
    $subject = "YOUR ORDER LIST FROM REACHEASY"; 
    $headers = "From: donotreply@rapsody.co.uk"; 
    $body = "$list"; 
    mail($to,$subject,$body,$headers);
    
    //Transfer records to wishlist 
    $transfer = mysql_query("INSERT INTO wishlist (SELECT  * FROM repplac WHERE username = '{$_SESSION['username']}')");
    // Delete temporary records if the above query was successful:
    if($transfer !== false){
        $deletetable = mysql_query("DELETE FROM repplac WHERE username = '{$_SESSION['username']}'");
    }
}     
redirect_to('youraccount.php'); 
?>

it is not updating, the record, and not sending the email, (but i echoed the email, and it came back correct),