Forums

PHP

This topic is locked

PHP debug issue

Posted 22 Aug 2004 18:47:06
1
has voted
22 Aug 2004 18:47:06 Matt Jones posted:
Hi you guys... I am new to the forum and was hoping maybe you could help me see the error of my ways, so to speak...

I am trying to debug some code and am unable to see what I am doing wrong.

Here is the background:
MySQL database table named "market" with fields for "agents" and "next agent" referenced by market ID which is passed in the URL. In the "agents" field there is an array of comma demited agent id$'s. In the "next agent" there is the last agent ID# in the "agents" array. Here is the code I have written:

"BEGINNING OF CODE <?php echo "ID: ";echo $MarketData->Fields('id'); ?>
<br>
<?php echo "Metro Area: "; echo $MarketData->Fields('MetroArea'); ?>
<br>
<?php echo "Agent List: "; echo $MarketData->Fields('Agents'); ?>
<br>
<?php echo "Original Next Agent: "; echo $MarketData->Fields('NextAgent'); ?>
<br>
<?php echo "New Next Agent: "; $splitData = split (",",$MarketData->Fields('Agents') ); $poppedData = array_pop ($splitData); echo $poppedData; ?>
<br>
<?php echo "New Agent List: "; $newAgents = array_unshift ($splitData,$poppedData); echo $newAgents?> END OF CODE"

What I am trying to do is this-- I want (on submit of this form) to go to the db and split the array at the commas, then pop the last number to the "next agent" field, and take the existing "next agent" value and array_unshift the old value in as the first value of the "agents" field. The idea being that I am leap-frogging the data and cycling through a series of agents in serving up their info to my site. I hope this makes sense.

Currently, as you can see, I am simply trying to echo the data to my screen and on the final line I am getting the number 2 instead of the actual new array. So what gives? What am I doing wrong? Any gurus out there that can educate your humble servant?

Replies

Replied 12 Jan 2011 07:51:17
12 Jan 2011 07:51:17 anny sharing replied:
Hi, guys,
More PHP debug info you can view:www.php.net

Reply to this topic