function gethotproperty($hot){
        $gethot = "select p.reference_id, p.area, p.area_unit, p.transaction_type,p.property_type,p.property_name,p.address1,p.address2,p.city,p.locality,p.pincode,p.area_in_sqft,p.total_price,p.negotiable,".
                        "p.rate_per_sqft,p.num_bedrooms,p.floor_number,p.intro_image_loc,p.amenities_detail, p.specification_detail, p.location_detail from " . DBConf::getDatabaseSchema() . "property p where p.hot = ".$hot;
        $result = mysql_query($gethot, $this->connection);

        $property = new Property();


        while($row = mysql_fetch_array($result)){
            $property->referenceId = $row['reference_id'];
            $property->transactionType = $row['transaction_type'];
            $property->propertyType = $row['property_type'];
            $property->propertyName = $row['property_name'];
            $property->address1 = $row['address1'];
            $property->address2 = $row['address2'];
            $property->city = $row['city'];
            $property->locality = $row['locality'];
            $property->pinCode = $row['pincode'];
            $property->areaInSqFt = $row['area_in_sqft'];
            $property->area = $row['area'];
            $property->areaUnit = $row['area_unit'];
            $property->totalPrice = $row['total_price'];
            $property->isNegotiable = $row['negotiable'];
            $property->ratePerSqFt = $row['rate_per_sqft'];
            $property->numberOfBedrooms = $row['num_bedrooms'];
            $property->floorNumber = $row['floor_number'];
            $property->amenities = $row['amenities_detail'];
            $property->introImageLocation = $row['intro_image_loc'];
            $property->specificationDetails = $row['specification_detail'];
            $property->locationDetails = $row['location_detail'];

        }
        return $property;
    }

what is wrong with this script.keep getting an error:

mysql_fetch_array(): supplied argument is not a valid MySQL result resource.

Recommended Answers

All 4 Replies

Looks like an error in your query. Change

$result = mysql_query($gethot, $this->connection);

into

$result = mysql_query($gethot, $this->connection) or die(mysql_error());

to check if I'm right.

Member Avatar for rajarajan2017

DB name in the config.php may be wrong.
May be a spelling Mistakes in sql statments

yes you were right. Thank you so much. it is solved.No error but not displaying anything.

Member Avatar for rajarajan2017

Mark the thread solved! if it solved

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.