Using this mysql/php conversion to mysqli question。我能够对自己的脚本进行编辑。当我运行这个脚本时,我没有记录,虽然我知道我直接查询数据库时产生的记录。我错过了什么?
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$file = 'matrix_swfl_res';
// connecting to database
//$connect = @mysql_connect($host.':'.$port, $user, $pass)or die (@mysql_error());
$connect = mysqli_connect( 'IP', 'User', 'Password', 'database', '3306')or die (@mysqli_error());
// selecting database
//@mysql_select_db($db,$connect) or die (@mysql_error());
header("Content-Type: text/xml;charset=UTF-8");
echo '<?xml version="1.0" encoding="UTF-8"?>
<Properties>';
// selecting data from "matrix combined"
$query = @mysqli_query("SELECT Acres, ActiveOpenHouseCount, AdditionalRooms, Amenities, AmenityRecFee, AmenRecFreq, ApartmentNumber, ApplicationFee, Approval, ApproxLivingArea, AssociationMngmtPhone, BathsFull, BathsHalf, BathsTotal, BedroomDesc, Bedrooms, BedsTotal, Block, BloggingYN, BoatAccess, BuilderProductYN, BuildingDesc, BuildingDesign, BuildingNumber, CableAvailableYN, CanalWidth, CarportDesc, CarportSpaces, CDOM, City, CloseDate, ClosePrice, CoListAgent_MUI, CoListAgentFullName, CoListOffice_MUI, CoListOfficeMLSID, CoListOfficeName, CoListOfficePhone, CommunityType, ConditionalDate, CondoFee, CondoFeeFreq, Construction, Cooling, CountyOrParish, CreatedDate, CurrentPrice, Development, DevelopmentName, DiningDescription, DOM, ElementarySchool, Elevator, Equipment, ExteriorFeatures, ExteriorFinish, Flooring, FloorPlanType, ForeclosedREOYN, FullAddress, FurnishedDesc, GarageDesc, GarageDimension, GarageSpaces, GuestHouseDesc, GuestHouseLivingArea, GulfAccessType, GulfAccessYN, Heat, HighSchool, HOADesc, HOAFee, HOAFeeFreq, InteriorFeatures, InternetSites, Irrigation, KitchenDescription, LandLeaseFee, LandLeaseFeeFreq, LastChangeTimestamp, LastChangeType, LeaseLimitsYN, LeasesPerYear, LegalDesc, LegalUnit, ListAgent_MUI, ListAgentDirectWorkPhone, ListAgentFullName, ListAgentMLSID, ListingOnInternetYN, ListOffice_MUI, ListOfficeMLSID, ListOfficeName, ListOfficePhone, ListPrice, LotBack, LotDesc, LotFrontage, LotLeft, LotRight, LotUnit, Maintenance, Management, MandatoryClubFee, MandatoryClubFeeFreq, MandatoryHOAYN, MasterBathDescription, MasterHOAFee, MasterHOAFeeFreq, Matrix_Unique_ID, MatrixModifiedDT, MiddleSchool, MinDaysofLease, MLS, MLSAreaMajor, MLSNumber, NumberofCeilingFans, OneTimeLandLeaseFee, OneTimeMandatoryClubFee, OneTimeOtheFee, OneTimeRecLeaseFee, OneTimeSpecialAssessmentFee, OriginalListPrice, OwnershipDesc, ParcelNumber, Parking, Pets, PetsLimitMaxNumber, PetsLimitMaxWeight, PetsLimitOther, PhotoCount, PhotoModificationTimestamp, Possession, PostalCode, PostalCodePlus4, PotentialShortSaleYN, PrivatePoolDesc, PrivatePoolYN, PrivateSpaDesc, PrivateSpaYN, PropertyAddressonInternetYN, PropertyInformation, PropertyType, RearExposure, Restrictions, Road, Roof, RoomCount, Section, SellingAgent_MUI, SellingAgentFullName, SellingAgentMLSID, SellingOffice_MUI, SellingOfficeMLSID, SellingOfficeName, SellingOfficePhone, SellPricePerSqFt, Sewer, SourceofMeasureLivingArea, SourceofMeasureLotDimensions, SourceofMeasureLotSize, SourceofMeasureTotalArea, SpecialAssessment, SpecialAssessmentFeeFreq, SpecialInformation, StateOrProvince, Status, StatusType, StormProtection, StreetDirPrefix, StreetDirSuffix, StreetName, StreetNumber, StreetNumberModifier, StreetSuffix, SubCondoName, SubdivisionNumber, TaxDesc, TaxDistrictType, Taxes, TaxYear, TotalArea, TotalFloors, Township, TransferFee, UnitCount, UnitFloor, UnitNumber, UnitsinBuilding, UnitsinComplex, View, VirtualTourURL, Water, WaterfrontDesc, WaterfrontYN, Windows, YearBuilt, ZoningCode, display_address_yn, list_on_internet_yn, Frame, Base, Img, latitude, longitude FROM matrix_swfl_res WHERE ListOfficeName LIKE 'Royal Shell%' AND ListPrice >= 100 AND PhotoCount >= 1");
while($row = @mysqli_fetch_array($query)){
$title = $row['MLSNumber'];
$listing = $row['Matrix_Unique_ID'];
$date = $row['CreatedDate'];
$fulladdress = $row['FullAddress'];
$Unit = $row['UnitNumber'];
$City= $row['City'];
$ZipCode= $row['PostalCode'];
$Latitude= $row['latitude'];
$Longitude= $row['longitude'];
$Community= $row['SubCondoName'];
$price = $row['ListPrice'];
//$description = $row['PropertyInformation'];
$description = htmlspecialchars($row['PropertyInformation'], ENT_QUOTES, 'utf-8');
$VisualTourUrl = $row['VirtualTourURL'];
$BedroomNumber = $row['Bedrooms'];
$BathroomNumber = $row['BathsTotal'];
$SqFt = $row['ApproxLivingArea'];
$Agent = $row['ListAgentFullName'];
$Agents = explode(" ", $Agent);
$agentname = explode(" ",$Agent);
$firstname = $agentname[0];
$lastname = array_pop($agentname);
$pic_count = $row['PhotoCount'];
$img = $row['Img'];
$base = $row['Base'];
echo '<Property>';
echo '<Adid>' . $title . '</Adid>';
echo '<Address1>' . $fulladdress . '</Address1>';
echo '<Address2>' . $Unit . '</Address2>';
echo '<City>' . $City . '</City>';
echo '<State>FL</State>';
echo '<Province></Province>';
echo '<Zip>' . $ZipCode . '</Zip>';
echo '<Longitude>' . $Longitude . '</Longitude>';
echo '<Latitude>' . $Latitude . '</Latitude>';
echo '<Region></Region>';
echo '<Community><![CDATA[' . $Community . ']]></Community>';
echo '<Country>USA</Country>';
echo '<Mls>' . $title . '</Mls>';
echo '<ContactData>';
echo '<ContactFirstName>' . $firstname . '</ContactFirstName>';
echo '<ContactLastName>' . $lastname . '</ContactLastName>';
echo '<ContactAgencyName>Royal Shell Real Estate</ContactAgencyName>';
echo '<ContactEmail>wsjInquiry@royalshellrealestate.com</ContactEmail>';
echo '<ContactURL><![CDATA[http://www.royalshellrealestate.com/search-results/?fullinfo=' . $title . ']]></ContactURL>';
echo '</ContactData>';
echo '<Brokerage>Royal Shell Real Estate</Brokerage>';
echo '<PostDate>' . $date . '</PostDate>';
echo '<VisualTourUrl><![CDATA[' . $VisualTourUrl . ']]></VisualTourUrl>';
echo '<OriginalListPrice>' . $price . '</OriginalListPrice>';
echo '<Terms>sell</Terms>';
echo '<MinPrice>' . $price . '</MinPrice>';
echo '<PropertyType>Single Family</PropertyType>';
echo '<BathroomNumber>' . $BathroomNumber . '</BathroomNumber>';
echo '<BedroomNumber>' . $BedroomNumber . '</BedroomNumber>';
echo '<Description><![CDATA[' . $description . ']]></Description>';
echo '<SqFt>' . $SqFt . '</SqFt>';
echo '<Images>';
for( $pic_start=1; $pic_start<=$pic_count; $pic_start++ ){
echo '<Image><![CDATA[http://www.myagentsbuddy.com/feeds/' . $img . '/rets_images/' . $listing . '_' . $pic_start . '.jpg]]></Image>';
}
echo '</Images>';
echo '</Property>';
}
echo '</Properties>';
?>