I am having these errors (I have checked around the line 5, and can't find any white line, and the sql on line. I have checked the spellings and syntax, they're alright.)
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/reachea2/public_html/orderpplac.php on line 53
Warning: Cannot modify header information - headers already sent by (output started at /home/reachea2/public_html/orderpplac.php:53) in /home/reachea2/public_html/include/functions.php on line 5
Code:
<?php
require_once("include/session.php");
require_once("include/dataconnect.php"); 
require_once("include/functions.php");
if (isset($_POST['submit1'])) {
    if(array_key_exists('item', $_POST)){
        // $items = $_POST['item'];
        //foreach($_POST['item'] as $item){
            //echo $item['Pquantity'] . ", ";
            //echo $item['Pidno'] . ", ";
        // }
        //Loop through $_POST items, updating the database for each item
        foreach ($_POST['item'] as $item) { 
            $Pquantity = intval($item['Pquantity']);
            $Pidno = ($item['Pidno']); 
            //echo $Pquantity . ", ";
            //echo $Pidno . ", ";
            $queryreg = mysql_query("
                UPDATE repplac
                SET Pquantity = {$Pquantity}
                WHERE Pidno = '{$Pidno}'
                AND Uname = '{$_SESSION['username']}'
            ") or die(mysql_error());  
        }
    }
}
else if (isset($_POST['submit2'])) {
    //Get Email Address
    $emails = mysql_query("SELECT reusers.email FROM reusers INNER JOIN repplac ON reusers.username = repplac.Uname AND reusers.username = '{$_SESSION['username']}'")or die(mysql_error());
    //$emails = mysql_query("SELECT reusers.email FROM reusers INNER JOIN repplac ON reusers.username = repplac.Uname AND reusers.username = '".$_SESSION['username']."'")or die(mysql_error());
    $results = (mysql_fetch_assoc($emails)) or die(mysql_error());
    $email= $results['email'];
    //echo "$email";
    //die();
    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
    $body = "<html><body><table border='1'>
    <tr>
        <th>Shop Name</th>
        <th>Product Name</th>
        <th>Size</th>
        <th>Color Name</th>
        <th>Quantity</th>
    </tr>";
    $pplresult = mysql_query("SELECT * FROM repplac WHERE Uname = '{$_SESSION['username']}')");   
    while($row = mysql_fetch_assoc($pplresult)){ 
        $body .= "<tr>
                <td>" . $row['Sname'] ."</td>
                <td>" . $row['Pname'] ."</td>
                <td>" . $row['Psize'] ."</td>
                <td>" . $row['Pcolour'] ."</td>
                <td>" . $row['Pquantity'] ."</td>
            </tr>";
    }
    $body .="</table></body></html>";
    //Send email
    $to = $email; 
    $subject = "YOUR ORDER LIST FROM REACHEASY"; 
    $headers = "From: donotreply@rapsody.co.uk\r\n";  
    $headers  .= 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    mail($to,$subject,$body,$headers);
    //Transfer records to wishlist 
    $transfer = mysql_query("INSERT INTO wishlist (SELECT  * FROM repplac WHERE Uname = '{$_SESSION['username']}')")or die(mysql_error());
    // Delete temporary records if the above query was successful:
    if($transfer !== false){
        $deletetable = mysql_query("DELETE FROM repplac WHERE Uname = '{$_SESSION['username']}'");
    }
}
redirect_to('youraccount.php'); 
?> body
 
     
     
     
     
    