You are here:  » WHAT SHOULD I DO?


WHAT SHOULD I DO?

Submitted by paschalis on Mon, 2008-03-24 16:39 in

Dear Guys,

i have to code below ...

$MARKET_ID = 198;
$LANGUAGE = 'EL';
  require("MagicParser.php");
  print $MARKET_ID; //1st ONE
  $counter = 0;
  $pseudo_counter = 1;
  $tmp_page = "";
  function myRecordHandler($record)
  {
  //global $counter;
  print $MARKET_ID; //2nd ONE
  $page = $record["PAGE"];
  $page = str_replace("'", "'", "$page");
  $title = $record["TITLE"];
  $title = str_replace("'", "'", "$title");
  $descr = $record["DESCRIPTION"];
  $descr = str_replace("'", "'", "$descr");
  $descr = str_replace("*", "", "$descr");
  $price = $record["PRICE"];
  $image = $record["IMAGE"];
  $size = $record["SIZE"];

............

The first print is printed but the second one is not. Also if i want to print $page or $title etc, it is not printed. What must i do?

Submitted by support on Mon, 2008-03-24 16:42

Hello Paschalis

You need to declare $MARKET_ID as global in myRecordHandler, that is probably all it is! Try:

  global $MARKET_ID;
  print $MARKET_ID; //2nd ONE

Cheers,
David.

Submitted by paschalis on Mon, 2008-03-24 16:46

Dear David, it worked. Thanks. But about my second question? why can't i print $title, $page etc?

Submitted by support on Mon, 2008-03-24 16:51

Hi,

Sorry Paschalis I missed the second part, my apologies.

At the moment, I do not see your code to print, for example, the title. I would expect you to have something like this:

  $title = $record["TITLE"];
  $title = str_replace("'", "'", "$title");
  print $title; // <-- this is the new line that prints the title

I think there is also something wrong with your str_replace. If you are trying to remove the ' character then it should probably be:

  $title = str_replace("'", "", "$title");

All the best,
David.