Ez one 4u... confused over: THIS->

just a moment of your time please. I’m a novice and am changing someone else’s code to suit me. my problem is this: I need to pull one extra field out of this guys DB table query - and use this extra field ($couple_id) in a query of my own. it is partially working. I am getting the $couple_id, but query is not working right as the value has been changed by wordwrap function.

his query:
$q = $this->queryEngine(“select *, date_format(created, ‘%b %e, %Y “.LANG_14.” %l:%i %p’) as created2 from “.DB_TABLE.” where parent = ‘$board2’ order by date asc”,$this->dbo);

then here is where he gets his stuff: my code has comments:
while($d = $this->dbo->spiderFetchArray($q))
{

			foreach($d as $key => $val)
			{
				$$key = htmlentities(stripslashes($val));
				
				if($key != 'parent' && $key != 'user' && $key != 'bid' && $key != 'created')
				{	
					$$key = '<p>'.str_replace("\

", “</p><p>”, $$key).‘</p>’;
} // end of IF key != parent, user, bid, and created
} // end of FOREACH

			$post = preg_replace("/&lt;p&gt;\\s&lt;\\/p&gt;/i", "&lt;p&gt;&nbsp;&lt;/p&gt;", $post);
			$origpost = $post;
			$post = $this-&gt;replaceCode($post,"quote","div","","quote");
			$post = $this-&gt;replaceCode2($post,$tag='you',$tag2='',$style='');
			$post = $this-&gt;replaceCode2($post,$tag='img',$tag2='img',$style='');
			$post = $this-&gt;replaceCode2($post,$tag='url',$tag2='a',$style='');
			$post = $this-&gt;replaceCode2($post,$tag='b',$tag2='strong',$style='');
			$user = wordwrap($user, 16, "&lt;br /&gt;", 1);
			$post = wordwrap($post, 70, "&lt;br /&gt;", 1);
		//	$couple_num = $this-&gt;$couple_id; // did not work!
			$couple_num = wordwrap($couple_id, 16, "&lt;br /&gt;", 1); // does echo right but my query does not like it!
			echo "Couple id is: " . $couple_num;

my query:
$query = “SELECT * FROM $activity WHERE member_id = ‘$couple_num’ LIMIT 1”;
$info_remote = mysql_query($query);
if ($records_found > 0) { do some stuff… }
else {$message_text = “no activity found.”;}

the code above echos the value for $couple_id - GOOD, but the query returns no records found. can you please tell me what is wrong with my attempt: $couple_num = $this->$couple_id; // did not work!

many thanks in advance! will return in a few hours.

i m new to php but want to ask a question ,why u r assigning $couple_id to another variable if it is available to this Code block.

it’s a long & ugly story dude… and not relevant to my issue. which is: how the hell do I pull couple_id out of the query without wordwrapping it? why does this line: $couple_num = $this->$couple_id; not work PLEASE???

Try $this->couple_id; (without the extra ‘$’).

Wouldn’t the existence of

$$key = htmlentities(stripslashes($val));

Mean that you could just simply use?

$couple_num = $couple_id;

Otherwise, I think this would still work too

$couple_num = $d['couple_id'];

OTHERWISE: $couple_num = $d[‘couple_id’]; works perfectly. thanks a million cpradio!! us rookies really appreciate you guys generous help. have a great day :slight_smile: