Jump to content

Recommended Posts

Hi all, I am new here :-)

 

I am working with joomla and have this code:


 

$sqlb = "SELECT a.id AS eventid"
		. "\nFROM #__eventlist_dates AS a"
		. "\nLEFT JOIN #__eventlist_locate AS b ON b.id = a.locid"
		. "\nLEFT JOIN #__eventlist_categories AS c ON c.id = a.catsid"
		. "\nWHERE a.published = 1"
		. "\nAND c.access <= $my->gid"
		. "\n$tf ".$sc
		. "\nORDER BY a.dates, a.times"
		. "\nLIMIT 0, $mcount";

			$database->setQuery($sqlb);
			$rowsb = $database->loadObjectList();

			//echo count($rowsb);

			for ($i=0;$i<count($rowsb);$i++) {

					$ani=get_object_vars($rowsb[$i]);
					$ani['eventid'];

					foreach ($ani as $b) {
						  $anib	= array($b);
							  echo $b;

					}

			}

 


 

That prints me the id of the items that are present in the database and all is ok.

 

Problem: I am trying to take each one of the results and insets them separately into a var, but I just don't know how to do that.

The ultimate goal is to be able to pass that var to another php script (maybe via cookie? I don't know - need help in that too).

 

Q: Can any one help?

 

 

// When I write this line I get a full result:

print_r($ani);

//

 

Thanks,

A.O

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/83131-array-and-db-question/
Share on other sites

It's much easier to just pass around $ani, which has all the values you need. Anytime you need to call a $ani element, just use $ani['needed_value'] and there you go...

 

To pass to another script... I'm not familiar with Joomla, but most CMS type apps have a certain set of initialization lines to make a page "start up", which also populates certain important variables and arrays. So, if your custom page uses that same "start up" process, you'll also get the necessary variables right up front. At any rate, you can pass $ani in directly using a variety of methods, or it's created during a start up, initialize the start up. We'd need more information if you can't figure it out from there...

 

PhREEEk

Link to comment
https://forums.phpfreaks.com/topic/83131-array-and-db-question/#findComment-422961
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.