I need to extract product`s but easy populate does not help me, cause i need to export for some site`s for pub like www.price.ro . i have this script but does not work. it doues not return nothing. if i try to change the datebase user and pass it does not return an error like I cant conect to datebase... nothing. pls help me. what is wrog?
<?php
set_time_limit(0);
// schimbati mai jos userul , parola si numele bazei de date
$prefix = "zen_";
$host = "localhost";
$user = "-------";
$passwd = "---------";
$dbName = "------------";
//------------------------------------------------------
$conn = mysql_connect("localhost", $user, $passwd);
if (!$conn) {
print "Nu pot sa creez conexiune la mysql";exit;
}
$selected_db = mysql_select_db($dbName, $conn);
if (!$selected_db) {
print "Nu pot sa selectez baza de date";exit;
}
$q = "
SELECT
p.products_id as cod,
cd.categories_name as numecategorie,
m.manufacturers_name as numemarca,
pd.products_name as numeprodus,
pd.products_description as descriere,
p.products_price as pret,
0 as stoc,
1 as activ,
CONCAT('http://www.site.com/images/', p.products_image) as poza1,
CONCAT('http://www.site.com/index.php?main_page=product_info&products_id=', p.products_id) as url_produs,
'' as garantie
FROM ".$prefix."products p
LEFT JOIN ".$prefix."manufacturers m ON (p.manufacturers_id = m.manufacturers_id)
LEFT JOIN ".$prefix."categories c ON (p.master_categories_id =c.categories_id)
LEFT JOIN ".$prefix."categories_description cd ON (c.categories_id=cd.categories_id)
LEFT JOIN ".$prefix."products_description pd ON (p.products_id=pd.products_id)
WHERE
p.products_status = 1
AND p.products_id = pd.products_id
AND pd.language_id = 1
ORDER BY p.products_id, pd.products_name
";
$cursor = mysql_query( $q, $conn );
$sep = ",";
$search=array("\n","\r",'"');
$replace=array('','','');
while ($r = mysql_fetch_array ($cursor))
{
$d = str_replace($search, $replace, $r[4]);
$d = strip_tags($d);
$cod= $r[0];
$numecategorie= str_replace($search, $replace,$r[1]);
$numemarca= str_replace($search, $replace,$r[2]);
$numeprodus= str_replace($search, $replace,$r[3]);
$pret = $r[5];
$instoc=$r[6];
$garantie=$r[10];
$url_produs= $r[9];
$url_poza1= $r[8];
print("$cod,\"$numemarca\",\"$numeprodus\",\"$url_produs\",\"$numecategorie\",$p ret,$instoc,$garantie");
print(",\"\",\"$d\",$url_poza1\n");}
?>
Bookmarks