RE: Problem using objects with array. please help me

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi
 
Hope I believe you used the foreach too in same routine; that?s why giving
problem because ?$I? variable
 
So change the variable name as $j, so that will resolve your problem.
 
$headers[$j] =array('date' =>$article_header ->date,'datesrc'
=>$article_header ->datesrc, 

'sendername' =>$article_header->sendername,'username'=>
$article_header->username, 

'subject'=>$article_header->subject, 'number' => $article_header ->number,
'id' =>$article_header->id, 'id_article' 

=>$article_header->id_article, 'body' =>$article_header->body); 
$j++;



 
 
Thanks,
Muthukumar Selvarasu,
Project Manager (Web Development),
Webmasters Ltd.
From: php-objects@xxxxxxxxxxxxxxx [mailto:php-objects@xxxxxxxxxxxxxxx] On
Behalf Of Danitzel Jurado
Sent: Thursday, January 03, 2008 4:36 AM
To: php-objects@xxxxxxxxxxxxxxx
Subject:  Problem using objects with array. please help me
 
I will explain the problem. 

When was executing this part was changing the info on the objects. This
piece of code was working in the other version of php 4

But right now It's showing the same article in every line. but If you print
the into that is getting during the cicle while You will see that the info
is changing them when is displaying it's showing the same article. seems
like It's not working

While($db->next_record()) 
{
// Build the $article_header object
$article_header->date = strtotime($db->Record['date']); // 2005-07-14 patch
$article_header->datesrc = $db->Record['datesrc']; // 2005-07-14 patch

//print "DBG src: ". $db->Record['date']. ", converted: ". strftime("%D %T",


$article_header->date). "<br>\n";

/* $db->Record['from_header'] = str_replace("[CROP_THAT]",'',
$db->Record['from_header']);
$address_struct =adressDecode( headerDecode($db->Record['from_header']),
"glabber.com");
$article_header->sendername = isset($address_struct[0]["personal"])?
$address_struct[0]["personal"]: 

$address_struct[0]["mailbox"];
$article_header->username = $article_header->sendername;
if (!isset($address_struct[0]["host"])) $address_struct[0]["host"] = '';
$article_header->email =
$address_struct[0]["mailbox"]."@".$address_struct[0]["host"]; */

// ===
$article_header->sendername = $db->Record['name'];
$article_header->username = $db->Record['username'];
$article_header->email = $db->Record['from_header'];

// 2005-08-11 Sometimes user just gives a word (name, e.g.) instead of an
e-mail:
if(empty($article_header->username) && !empty($article_header->email) &&
strpos('@', 

$article_header->email) === false)
{
$article_header->username = $article_header->email;
}

$article_header->subject = $db->Record['subject'];
$article_header->number = $db->Record['number']; 
$article_header->id = $db->Record['id']; 
$article_header->id_article = $db->Record['id_article'];
$article_header->body = $db->Record['body'];
$headers[] = $article_header;
} 

I did this 

$headers[$i] =array('date' =>$article_header ->date,'datesrc'
=>$article_header ->datesrc, 

'sendername' =>$article_header->sendername,'username'=>
$article_header->username, 

'subject'=>$article_header->subject, 'number' => $article_header ->number,
'id' =>$article_header->id, 'id_article' 

=>$article_header->id_article, 'body' =>$article_header->body); 
$i++;

It's working but the problem now is 
that foreach 

foreach($headers as $i=>$h)
{ 
it's not working please help me

Danitzel Jurado 

celular: 6727-0315

---------------------------------

¡Capacidad ilimitada de almacenamiento en tu correo!
No te preocupes más por el espacio de tu cuenta con Correo Yahoo!:
http://correo.espanol.yahoo.com/

[Non-text portions of this message have been removed]
 


[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux