Jump to content

Help with one PHP script... and settings on server


Vixushr

Recommended Posts

Helo,

 

Ihave one script that servers as download link for my customers to download pricelist in XML form.

 

Script it self works but problem is that my host upgraded PHP on servers and script now works only if theres one less field to generate in XML.

This is script

<?php

$langHr = 7;
include(dirname(__FILE__).'/config/config.inc.php');
require_once(dirname(__FILE__).'/init.php');

error_reporting(0);
$p=Product::getProducts(7, 0, 0, 'id_product', 'desc', false);
$products=Product::getProductsProperties(7, $p);

header("Content-Type: text/xml\n\n");
//print "Content-type: text/html\n\n";
echo '<?xml version="1.0" encoding="utf-8"?>

<Catalog>';

foreach ($products as $row) {
if($row['active']==1){


$img=Product::getCover($row['id_product']);

if ($row['quantity'] >= 5)
{
$row['quantity'] = "5";
}

echo '
<product>
    <ID>'.str_replace("&", "&", $row['id_product']).'</ID>
    <name>'.str_replace("&", "&", $row['name']).'</name>
    <description>'.str_replace("&", "and", strip_tags($row['description_short'])).'</description>
    <price>'.($row['price']*1).'</price>
    <quantity>'.str_replace("&", "&", $row['quantity']).'</quantity>
    <category>'.str_replace("&", "&", $row['category']).'</category>
    <link>'.$row['link'].'</link>
    <image>http://www.myshop/'.$shopUrl.'img/p/'.$row['id_product'].'-'.$img['id_image'].'.jpg</image>
echo'</product>';
}
}
echo '</Catalog>';
?>

 

And since these server changes this script now works only if i remove one row from product data... any row, it doesnt mather... as long as theres only 7 of them?

 

Can anybody tell me what causes this... what to change on server to make it work, or how to change a script?

 

Thank you!

 

V.

 

PS: Sever was updated from php 5.2 to 5.3

A) What output do you get when there are too many fields and what exactly is wrong with the output? Show some sample data that works and some sample data that does not.

 

B) We would need to have all the code necessary to reproduce the problem. Without the Product class, we have no way of knowing what the parameters even mean, what the code does, or what the data it returns looks like.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.