Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Dec 2009
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Need help with a function

    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?

    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:

    PHP Code:
    $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:
    PHP Code:
    $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...

    Any advice is much appreciated. Thank you.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    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?
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #3
    New Coder
    Join Date
    Dec 2009
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts
    PHP Code:
    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

    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:
    PHP Code:
        <select name="address_state" size="1">
                <option value="">Please select</option>
    <?php
        
    if (!empty($this->zones)) {
            foreach(
    $this->zones as $row) {
    ?>
                <option value="<?php echo $row->id_zone;?>"><?php echo $row->zone_name;?></option>
    <?
            
    }
        }
    ?>
            </select>
    Last edited by jgarite; 01-08-2010 at 06:07 PM.

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    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.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •