Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7185877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:30:45+00:00 2026-05-28T18:30:45+00:00

I just finished a script to import data from an XML file to MySQL,

  • 0

I just finished a script to import data from an XML file to MySQL, I have more than 280,000+ row, but after the import is done I only see 91,000 rows. After verifying if every query was running without any problem, I found the following one :

INSERT INTO `hotels` (`hotelId`, `hotelFileName`, `hotelName`, `rating`, `cityId`, `cityFileName`, `cityName`, `stateId`, `stateFileName`, `stateName`, `countryCode`, `countryFileName`, `countryName`, `imageId`, `Address`, `minRate`, `currencyCode`, `Latitude`, `Longitude`, `NumberOfReviews`, `ConsumerRating`, `PropertyType`, `ChainID`, `Facilities`) VALUES (1568054, 'Der_Obere_Wirt_zum_Queri', '\"Der Obere Wirt\" zum Queri', 3, 34633, 'Andechs', 'Andechs', 212, 'Bavaria', 'Bavaria', 'DE', 'Germany', 'Germany', 51498149, 'Georg Queri Ring 9', 92.1476, 'EUR', '48.009423000000', '11.214504000000', 16, 8.5, 0, 0, '1|3|5|8|22|27|45|49|53|56|64|66|67|139|202|209|213|256|')

Warning: mysql_free_result() expects parameter 1 to be resource, boolean given in /home/hotels/public_html/insert.php on line 57
INSERT INTO `hotels` (`hotelId`, `hotelFileName`, `hotelName`, `rating`, `cityId`, `cityFileName`, `cityName`, `stateId`, `stateFileName`, `stateName`, `countryCode`, `countryFileName`, `countryName`, `imageId`, `Address`, `minRate`, `currencyCode`, `Latitude`, `Longitude`, `NumberOfReviews`, `ConsumerRating`, `PropertyType`, `ChainID`, `Facilities`) VALUES (1658359, 'Seclusions_of_Yallingup', '\"Seclusions\" of Yallingup', 4, 72257, 'Yallingup', 'Yallingup', 172, 'Western_Australia', 'Western Australia', 'AU', 'Australia', 'Australia', 53234107, '58 Zamia Grove', 238.7800, 'AUD', '-33.691192000000', '115.061938999999', 0, 0, 3, 0, '3|6|13|14|21|22|28|39|40|41|51|53|54|56|57|58|65|66|141|191|202|204|209|210|211|292|')

Warning: mysql_free_result() expects parameter 1 to be resource, boolean given in /home/hotels/public_html/insert.php on line 57
INSERT INTO `hotels` (`hotelId`, `hotelFileName`, `hotelName`, `rating`, `cityId`, `cityFileName`, `cityName`, `stateId`, `stateFileName`, `stateName`, `countryCode`, `countryFileName`, `countryName`, `imageId`, `Address`, `minRate`, `currencyCode`, `Latitude`, `Longitude`, `NumberOfReviews`, `ConsumerRating`, `PropertyType`, `ChainID`, `Facilities`) VALUES (1491947, '1_Melrose_Blvd', '#1 Melrose Blvd', 5, 964, 'Johannesburg', 'Johannesburg', NULL, '', '', 'ZA', 'South_Africa', 'South Africa', 46777171, '1 Melrose Boulevard Melrose Arch', , 'ZAR', '-26.135656000000', '28.067751000000', 0, 0, 9, 0, '6|7|9|11|12|15|17|18|21|32|34|39|41|42|50|51|56|58|60|140|173|202|293|296|')
Invalid query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 'ZAR', '-26.135656000000', '28.067751000000', 0, 0, 9, 0, '6|7|9|11|12|15|17|18' at line 1

This is my query code :

if($obj->stateFileName != "")
    {
    $query = "INSERT INTO `hotels` (`hotelId`, `hotelFileName`, `hotelName`, `rating`, `cityId`, `cityFileName`, `cityName`, `stateId`, `stateFileName`, `stateName`, `countryCode`, `countryFileName`, `countryName`, `imageId`, `Address`, `minRate`, `currencyCode`, `Latitude`, `Longitude`, `NumberOfReviews`, `ConsumerRating`, `PropertyType`, `ChainID`, `Facilities`) VALUES ({$obj->hotelId}, '".mysql_real_escape_string($obj->hotelFileName)."', '".mysql_real_escape_string($obj->hotelName)."', {$obj->rating}, {$obj->cityId}, '".mysql_real_escape_string($obj->cityFileName)."', '".mysql_real_escape_string($obj->cityName)."', {$obj->stateId}, '".mysql_real_escape_string($obj->stateFileName)."', '".mysql_real_escape_string($obj->stateName)."', '{$obj->countryCode}', '".mysql_real_escape_string($obj->countryFileName)."', '".mysql_real_escape_string($obj->countryName)."', {$obj->imageId}, '".mysql_real_escape_string($obj->Address)."', {$obj->minRate}, '{$obj->currencyCode}', '{$obj->Latitude}', '{$obj->Longitude}', {$obj->NumberOfReviews}, {$obj->ConsumerRating}, {$obj->PropertyType}, {$obj->ChainID}, '{$obj->Facilities}')";
    $result = mysql_query($query);
    }
    else
    {
    $query = "INSERT INTO `hotels` (`hotelId`, `hotelFileName`, `hotelName`, `rating`, `cityId`, `cityFileName`, `cityName`, `stateId`, `stateFileName`, `stateName`, `countryCode`, `countryFileName`, `countryName`, `imageId`, `Address`, `minRate`, `currencyCode`, `Latitude`, `Longitude`, `NumberOfReviews`, `ConsumerRating`, `PropertyType`, `ChainID`, `Facilities`) VALUES ({$obj->hotelId}, '".mysql_real_escape_string($obj->hotelFileName)."', '".mysql_real_escape_string($obj->hotelName)."', {$obj->rating}, {$obj->cityId}, '".mysql_real_escape_string($obj->cityFileName)."', '".mysql_real_escape_string($obj->cityName)."', NULL, '', '', '{$obj->countryCode}', '".mysql_real_escape_string($obj->countryFileName)."', '".mysql_real_escape_string($obj->countryName)."', {$obj->imageId}, '".mysql_real_escape_string($obj->Address)."', {$obj->minRate}, '{$obj->currencyCode}', '{$obj->Latitude}', '{$obj->Longitude}', {$obj->NumberOfReviews}, {$obj->ConsumerRating}, {$obj->PropertyType}, {$obj->ChainID}, '{$obj->Facilities}')";
    $result = mysql_query($query);  
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T18:30:46+00:00Added an answer on May 28, 2026 at 6:30 pm

    For the You have an error in your SQL syntax error, you can just look at the actually query where it tells you to spot the problem. Searching for ZAR I found this:

    ..., '1 Melrose Boulevard Melrose Arch', , 'ZAR', '-26.135656000000', ...
    

    As you can see, , , is not valid syntax, it is missing an element. Looking at your code it seems like it is missing {$obj->minRate}. This field is empty for some records (or at least for the one record you posted). To fix this, you can try replacing that with:

    is_null($obj->minRate) ? 'NULL' : $obj->minRate
    

    For the mysql_free_result warning, you haven’t shown the code where that method is called, so it’s hard to say what that’s about.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just finished reading Crockford's JavaScript: The Good Parts and I have a question concerning
I just finished reading this post: https://developer.yahoo.com/performance/rules.html#flush and have already implemented a flush after
I have this large (and oddly formatted txt file) from the USDA's website. It
I have created a lottery script in php. My problem is now selecting more
I'm trying to make a PHP script, I have the script finished but it
I just finished my a Batch COLOR script that accepts Color-names, Decimals and Hex
I have a file check and sort script. Now I wanted the user to
I have a PHP script that needs to download several files from a remote
I wrote a script in python that scans a file and extract strings from
I just finished writing this script and getting it to work but I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.