PHP中的未知问题[重复]

I cannot work out why I am receiving this error:

mysql_fetch_assoc() expects parameter 1 to be resource, boolean given on line 32

I have tried searching for the answer but have had no such luck.

I am self taught learning to code and any help would be greatly appreciated.

<table>
    <thead>
        <tr>
            <td>First Name</td>
            <td>Last Name</td>
            <td>Email</td>
        </tr>
    </thead>
    <tbody>
    <?php

    $mysql_host = 'localhost';
    $mysql_user = 'root';
    $mysql_pass = '';
    mysql_connect($mysql_host, $mysql_user, $mysql_pass);


    /* #1 get properties and it's data  */
    $seller_id="SELECT id FROM seller WHERE coupon_id='ab2345'" or die(mysql_error());
    $property="SELECT bedrooms, bathrooms, parking FROM property WHERE seller_id='{$seller_id}'" or die(mysql_error());
    $results = mysql_query($property);

    /* #2 store property data in variable */
    $property_row = mysql_fetch_assoc($results);
    $bathrooms = $property_row['bathrooms'];
    $bedrooms = $property_row['bedrooms'];
    $parking = $property_row['parking'];

    /*#3 get buyers (& their data) using property data as inputs */
    $buyers="SELECT * FROM buyers WHERE bedrooms={$bedrooms} AND bathrooms={$bathrooms} AND parking={$parking}" or die(mysql_error());
    $results = mysql_query($buyers);

    /* #4 loop through buyers */
    if (mysql_num_rows($results) < 1) echo "Oh no it seems like their are no buyers for your property"; else {
    while ($row = mysql_fetch_assoc($results)) {
    ?>
            <tr>
                <td><?php echo $row['f_name']?></td>
                <td><?php echo $row['l_name']?></td>
                <td><?php echo $row['email']?></td>
            </tr>

        <?php
        }
    }
        ?>
        </tbody>
        </table>
</div>

mysql returns a resource when there is no error in your query but returns false (a booean data type and an unsuitable parameter for mysql_fetch...) when there is an error.

Your PHP code should check the return code to make sure that it is "truthy" (ie not false) before trying to use it to fetch. If the return is false, there are two mysql functions that you can use to determine the problem. One ,mysql_error(), returns an error number (good for switch statements to process) the other, mysql_errmsg() returns a textual error message (good for programmers to read).

One of the commenters told you what the error in your query was but that does not deal with the structural flaw in your code where you do not check for a good return value before trying to use it.