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 8672915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:19:17+00:00 2026-06-12T19:19:17+00:00

What im trying to accomplish is to increase create and increase a value in

  • 0

What im trying to accomplish is to increase create and increase a value in XML.

Code:

    // CONNECT TO DATABASE
    $SQL = "SELECT * FROM ads ORDER BY id DESC";
    $result = mysql_query($SQL);

    // OPEN XML
    $_xml = "<?xml version='1.0' encoding='UTF-8' ?>\n";
    $_xml .="<ADS>\n";

    while ($db_field = mysql_fetch_assoc($result)) {

    $_xml .=" <AD>\n";
    $_xml .="   <ID><![CDATA[" . $counter . "]]></ID>\n";
    $_xml .="   <TITLE><![CDATA[" . $db_field['title'] . "]]></TITLE>\n";
    $_xml .="   <DESCRIPTION><![CDATA[" . $db_field['description'] . "]]></DESCRIPTION>\n";
    $_xml .="   <EMAIL><![CDATA[" . $db_field['email'] . "]]></EMAIL>\n";
    $_xml .="   <PHONE><![CDATA[" . $db_field['phone'] . "]]></PHONE>\n";
    $_xml .="   <ADDRESS><![CDATA[" . $db_field['address'] . "]]></ADDRESS>\n";
    $_xml .="   <ZIP_CODE><![CDATA[" . $zipcode . "]]></ZIP_CODE>\n";
    $_xml .="   <LOCATION_COUNTRY><![CDATA[" . $country . "]]></LOCATION_COUNTRY>\n";
    $_xml .="   <LOCATION_STATE><![CDATA[" . $state . "]]></LOCATION_STATE>\n";
    $_xml .="   <LOCATION_CITY><![CDATA[" . $city . "]]></LOCATION_CITY>\n";
    $_xml .="   <CATEGORY><![CDATA[" . $db_field['category'] . "]]></CATEGORY>\n";
    $_xml .="   <BEDROOMS>" . $db_field['bedrooms'] . "</BEDROOMS>\n";
    $_xml .="   <BATHROOMS>" . $db_field['bathrooms'] . "</BATHROOMS>\n";
    $_xml .="   <PETS>" . $db_field['pets'] . "</PETS>\n";
    $_xml .="   <BROKERFEE>" . $broker . "</BROKERFEE>\n";
    $_xml .="   <SURFACE>" . $db_field['surface'] . "</SURFACE>\n";
    $_xml .="   <IMAGE_URL><![CDATA[" . $db_field['image_url'] . "]]></IMAGE_URL>\n";
    $_xml .="   <IMAGE_URL><![CDATA[http://www.path to image]]></IMAGE_URL>\n";
    $_xml .="   <PRICE>" . $db_field['price'] . "</PRICE>\n";
    $_xml .="   <CURRENCY>" . $currency . "</CURRENCY>\n";
    $_xml .=" </AD>\n";
    } 

    // CLOSE XML
    $_xml .="</ADS>";

    // ECHO XML DATA
    echo $_xml;

I want the “$counter” to provide a value of 1 and for every extra result it should at 1. Not my cup of joe, total noob when it comes to this. I can get a value from the mysql database, but requires that the first item should start with value 1.

  • 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-06-12T19:19:19+00:00Added an answer on June 12, 2026 at 7:19 pm

    Replace $counter with ++$counter.

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

Sidebar

Related Questions

So I am trying to accomplish something like this: SELECT * FROM table WHERE
I'm trying to accomplish a simple task of creating a database with 2 tables
I'm trying to accomplish the following: Have a thread that reads data from a
What I'm trying to accomplish: create a clickabel hyperlink in the message text displayed
I'm trying to accomplish something like this, var data = from p in db.Projects
I'm trying to accomplish a multiple word searching in a quotes database using Ruby,
Im trying to accomplish something which may seem a bit convoluted but would be
I'm trying to accomplish a simple thing. I have a 2 levels menu with
I'm trying to accomplish something very, very similar to the below picture with CSS3
I'm trying to accomplish this but I've got no clue about getting a GWT

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.