View Full Version : Need help with a function

01-08-2010, 06:50 PM
Ok, so i'm new to a website I'm working with and am unfamiliar with much of the code, so I apologize that I keep posting for help, but how else will I learn if I don't ask, right? :o

That said;
In my database table for country zones I have two ids, 227 and 228. they are associated with the proepr zones in USA and Canada ( the states and provinces). the code that is currently written is:

$zone = new CountryZone();
$this->view->zones = $zone->getCountryZones(227);

the new zone, 228, needs to be added to that so that when a new user comes to sign up, they can also choose the Canadian provinces...
I have tried:

$zone = new CountryZone();
$this->view->zones = $zone->getCountryZones(227) . $zone->getCountryZones(228);
But that didn't work...I'm guessing because this isn't a string? I'm not even sure what the proper name for the "$this...." line is... :confused:

Any advice is much appreciated. Thank you.

01-08-2010, 07:01 PM
This cannot be used in a global context, so unless this is inside a class method it will throw a fatal exception.
What is the return type of getCountryZones in the CountryZone class?

01-08-2010, 07:05 PM
public function signup() {

$stdObj = new User();
$cObj = new UserCredentials();

$country = new Country();
$this->view->countries = $country->getAllRows();

$zone = new CountryZone();
$this->view->zones = $zone->getCountryZones(227);

there is a lot more, but I don't know how much of the code I can post safely :o

opps, i think this is maybe what you meant, from the rendered page. the previous codes were in the includes files for this rendered page:

<select name="address_state" size="1">
<option value="">Please select</option>
if (!empty($this->zones)) {
foreach($this->zones as $row) {
<option value="<?php echo $row->id_zone;?>"><?php echo $row->zone_name;?></option>

01-08-2010, 07:44 PM
No, what I need is the entire function from CountryZone called getCountryZones. Its possible that the second block is from that function, if it is you will need to return you're output code, not print it.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum