Having error accessing transfered database

(i have a database online that works well online that is accessing the database from the host server)but i copied my database from my host to my localhost on xampp(so as to have a copy on my system), but when i try to access one of the database on my localhost i have the error below, what can i do

Warning: mysql_query() expects parameter 2 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/comparison/includes/database.php on line 18

Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in /Applications/XAMPP/xamppfiles/htdocs/comparison/includes/database.php on line 27

Warning: mysql_num_rows() expects parameter 1 to be resource, null given in /Applications/XAMPP/xamppfiles/htdocs/comparison/includes/database.php on line 32

Warning: mysql_query() expects parameter 2 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/comparison/includes/database.php on line 18

Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in /Applications/XAMPP/xamppfiles/htdocs/comparison/includes/database.php on line 27

Warning: mysql_num_rows() expects parameter 1 to be resource, null given in /Applications/XAMPP/xamppfiles/htdocs/comparison/includes/database.php on line 32

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /Applications/XAMPP/xamppfiles/htdocs/comparison/includes/database.php:18) in /Applications/XAMPP/xamppfiles/htdocs/comparison/html/header.php on line 1

Warning: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/comparison/includes/database.php:18) in /Applications/XAMPP/xamppfiles/htdocs/comparison/html/header.php on line 8

Have you connected to the database first and has the user that you’re using to connect to the database got the relevant permissions?

Well, the session_start() errors mean that you didn’t put session_start() at the top of the page before printing anything to the screen. Try moving the session_start to the top of your file.

These are all warnings, and you obviously have display_errors turned off on the server you retrieved the file from. Always a good idea to have display_errors set to 1 on your test server to test these things before going live. Do you have the PHP that you can show us so we can take a look?

this is one of the page below


<?php require_once("include/session.php");?>
<?php require_once("include/functions.php");?>
<?php include("include/header.php");?>
<ul  id="advert">
<!--<li><iframe src="http://rcm-uk.amazon.co.uk/e/cm?t=r0ab-21&o=2&p=20&l=ur1&category=generic&banner=0YCR1B12KQC9EA34FF02&f=ifr" width="120" height="90" scrolling="no" border="0" marginwidth="0" style="border:none;" frameborder="0"></iframe></li>-->
 <script language="javascript" type="text/javascript">
var myTarget='http://track.webgains.com/click.html?wglinkid=131304&wgcampaignid=109835&js=0';
var uri = 'http://track.webgains.com/link.html?wglinkid=131304&wgcampaignid=109835';
document.write('<a href="'+myTarget+'" target="_blank" onMouseOver="window.status=\\'http://www.lingerieplease.co.uk\\';return true;" onMouseOut="window.status=\\'\\'"><img src="'+uri+'" width="125" height="125" border="0" alt=""/></a>');
</script>
 <li><iframe src="http://rcm-uk.amazon.co.uk/e/cm?t=r0ab-21&o=2&p=11&l=ur1&category=endless&banner=1BXHM01F8MNJJGXPV2R2&m=endless&f=ifr&lt1=_new" width="150" height="600" scrolling="no" border="0" marginwidth="0" style="border:none;" frameborder="0"></iframe></li>
</ul>

</div> <!--end of navigation div -->
<div id="bodycontent">
<div id="bannercontainer">
            <ul id="banner-ids">
                <li class="banner-id">
                   <a href="http://click.linksynergy.com/fs-bin/click?id=XMrvFY8rz5s&offerid=219812.10000009&type=4&subid=0"><IMG alt="" border="0" src="http://www.fragrancenet.com/LSbanners/Linkshare_FNET_125x125_UK.jpg"></a><IMG border="0" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=XMrvFY8rz5s&bids=219812.10000009&type=4&subid=0">
                </li>
                <li class="banner-id">
                    <script language="javascript" type="text/javascript">
						var myTarget='http://track.webgains.com/click.html?wglinkid=186424&wgcampaignid=109835&js=0';
							var uri = 'http://track.webgains.com/link.html?wglinkid=186424&wgcampaignid=109835';
								document.write('<a href="'+myTarget+'" target="_blank" onMouseOver="window.status=\\'http://www.yoursclothing.co.uk?S=WG\\';return true;" onMouseOut="window.status=\\'\\'"><img src="'+uri+'" width="125" height="125" border="0" alt="Yours Clothing - Great Value Plus Size Retailer"/></a>');
							</script>
							 <li class="banner-id">
                <a href="http://click.linksynergy.com/fs-bin/click?id=XMrvFY8rz5s&offerid=248924.28&subid=0&type=4"><IMG border="0"   alt="Proskins Slim Free Shipping" src="http://ad.linksynergy.com/fs-bin/show?id=XMrvFY8rz5s&bids=248924.28&subid=0&type=4&gridnum=4"></a>
                </li>
                </li>
                <li class="banner-id" style="clear:left">
               <a target='new' href="http://click.linksynergy.com/fs-bin/click?id=XMrvFY8rz5s&offerid=242088.9&subid=0&type=4"><IMG border="0"   alt="Bonsoir of London" src="http://ad.linksynergy.com/fs-bin/show?id=XMrvFY8rz5s&bids=242088.9&subid=0&type=4&gridnum=11">
               </a>
                </li>
                <li class="banner-id">
                    <script type="text/javascript">
                        var uri = 'http://impgb.tradedoubler.com/imp?type(img)g(17412240)a(1921176)' + new String(Math.random()).substring(2, 11);
                        document.write('<a href="http://clkuk.tradedoubler.com/click?p=68951&a=1921176&g=17412240" target="_BLANK"><img src="' + uri + '" border=0></a>');

                    </script>
                </li>
                 <li class="banner-id">
                    <script type="text/javascript">
						var uri = 'http://impgb.tradedoubler.com/imp?type(img)g(20142718)a(1921176)' + new String (Math.random()).substring (2, 11);
						document.write('<a href="http://clkuk.tradedoubler.com/click?p=58330&a=1921176&g=20142718" target="_BLANK"><img src="'+uri+'" border=0></a>');
					</script>
                </li>
            </ul>
            <div style="clear: both"></div>
        </div>
<div id="pbanner">
  <ul id="promo-banners">
  <li class="promo-banner">
    <h2>
        <a href="/comparison/category/clotheswomen/">Women's Clothing</a>
     </h2>
<a href="/comparison/category/clotheswomen/"><img height="198" width="228"  src="img/wc.jpg" alt=" alibi"/>
</a>
<p class="promo-seo">
 quality at reasonable price
<a href="/comparison/category/clotheswomen/">Women's Clothing</a>
</p>
  </li>
<li class="promo-banner">
    <h2>
        <a href="/comparison/category/shoeswomen/"> Women's Shoe </a>
     </h2>
<a href="/comparison/category/shoeswomen/"><img height="198" width="228"  src="img/womensshoe.jpg" alt=" alabi"/>
</a>
<p class="promo-seo">
quality at reasonable price
<a href="/comparison/category/shoeswomen/"> Women's Shoe </a>
</p>
  </li>
<li class="promo-banner">
    <h2>
      <a href="/comparison/category/underwear women/">Underwear&amp;Lingerie</a>
     </h2>
<a href="/comparison/category/underwear women/"><img height="198" width="228"  src="img/underwear.jpg" alt=" alabi"/>
</a>
<p class="promo-seo">
 quality at reasonable price
 <a href="/comparison/category/underwear women/">Underwear&amp;Lingerie</a>
</p>
  </li>
<li class="promo-banner">
    <h2>
        <a href="http://click.linksynergy.com/fs-bin/click?id=XMrvFY8rz5s&offerid=219812.10000009&type=4&subid=0">Perfume</a>
     </h2>
<a href="http://click.linksynergy.com/fs-bin/click?id=XMrvFY8rz5s&offerid=219812.10000009&type=4&subid=0"><img height="198" width="228"  src="img/pe.jpg" alt=" alabi"/>
</a>
<p class="promo-seo">
 quality at reasonable price
 <a href="http://click.linksynergy.com/fs-bin/click?id=XMrvFY8rz5s&offerid=219812.10000009&type=4&subid=0">Perfume</a>
</p>
  </li>
<li class="promo-banner">
    <h2>
        <a href="/comparison/category/accessorieswomen/">Accessories</a>
     </h2>
<a href="/comparison/category/accessorieswomen/"><img height="198" width="228"  src="img/womensaccessories.jpg" alt=" alabi"/>
</a>
<p class="promo-seo">
quality at reasonable price
 <a href="/comparison/category/accessorieswomen/">Accessories</a>
</p>
  </li>
<li class="promo-banner">
    <h2>
        <a href="/comparison/category/morewomen/">More</a>
     </h2>
<a href="/comparison/category/morewomen/"><img height="198" width="228"  src="img/men.jpg" alt=" alabi"/>
</a>
<p class="promo-seo">
 quality at reasonable price
<a href="/comparison/category/morewomen/">More</a>
</p>
  </li>
  </ul>
  </div>
</div>
</div>
<?php include("include/footer.php");?>

will i have to make the
DB_USER and DB_PASS the same for the host server and the local host

will i have to make the
DB_USER and DB_PASS the same for the host server and the local host

The error messages state that the issue is in the database.php file. Can you post that file as well? Make sure before you post it to erase any database log in information. You don’t want that info floating around on the web.

The problem is that your database connection failed.

$db = mysql_connect(…)
if the method returns FALSE, then when you do
mysql_query(“Some query here”,$db), you’re putting FALSE into the second parameter. FALSE is a boolean. Hence the error:
Warning: mysql_query() expects parameter 2 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/comparison/includes/database.php on line 18

(PS: This was covered in the “Common PHP Problems” thread at the top of this forum.)