Jump to content

colap

Members
  • Posts

    302
  • Joined

  • Last visited

Posts posted by colap

  1. If i click the login link i get error =>

     

        Notice: Array to string conversion in /var/www/site/library/Zend/View/Helper/HtmlElement.php on line 104 
    
        Call Stack: 
        0.0003 335540 
        1. {main}() /var/www/site/public/index.php:0 0.0682 4242800 
        2. Zend_Application->run() /var/www/site/public/index.php:26 0.0683 4242800 
        3. Zend_Application_Bootstrap_Bootstrap->run() /var/www/site/library/Zend/Application.php:366 0.0684 4242872 
        4. Zend_Controller_Front->dispatch() /var/www/site/library/Zend/Application/Bootstrap/Bootstrap.php:97 0.0789 4866464 
        5. Zend_Controller_Dispatcher_Standard->dispatch() /var/www/site/library/Zend/Controller/Front.php:954 0.0867 5201824 
        6. Zend_Controller_Action->dispatch() /var/www/site/library/Zend/Controller/Dispatcher/Standard.php:295 0.1095 6672344 
        7. Zend_Controller_Action_HelperBroker->notifyPostDispatch() /var/www/site/library/Zend/Controller/Action.php:523 0.1095 6673344 
        8. Zend_Controller_Action_Helper_ViewRenderer->postDispatch() /var/www/site/library/Zend/Controller/Action/HelperBroker.php:277 0.1096 6673344     
        9. Zend_Controller_Action_Helper_ViewRenderer->render() /var/www/site/library/Zend/Controller/Action/Helper/ViewRenderer.php:957 0.1107 6673592 
        10. Zend_Controller_Action_Helper_ViewRenderer->renderScript() /var/www/site/library/Zend/Controller/Action/Helper/ViewRenderer.php:918 0.1107 6673592 
        11. Zend_View_Abstract->render() /var/www/site/library/Zend/Controller/Action/Helper/ViewRenderer.php:897 0.1108 6714828 
        12. Zend_View->_run() /var/www/site/library/Zend/View/Abstract.php:880 0.1109 6716384     
        13. include('/var/www/site/application/views/scripts/index/login.phtml') /var/www/site/library/Zend/View.php:108 0.1133 6810172 
        14. Zend_Form->__toString() /var/www/site/library/Zend/Form.php:0 0.1133 6810172 
        15. Zend_Form->render() /var/www/site/library/Zend/Form.php:2903 0.1168 6970720 
        16. Zend_Form_Decorator_FormElements->render() /var/www/site/library/Zend/Form.php:2887 0.1336 7588600 
        17. Zend_Form_Element->render() /var/www/site/library/Zend/Form/Decorator/FormElements.php:101 0.1345 7590872 
        18. Zend_Form_Decorator_ViewHelper->render() /var/www/site/library/Zend/Form/Element.php:2020 0.1362 7609432 
        19. Zend_View->formPassword() /var/www/site/library/Zend/Form/Decorator/ViewHelper.php:246 0.1362 7609880 
        20. Zend_View_Abstract->__call() /var/www/site/library/Zend/View/Abstract.php:0 0.1362 7610208 
        21. call_user_func_array() /var/www/site/library/Zend/View/Abstract.php:342 0.1362 7610656 
        22. Zend_View_Helper_FormPassword->formPassword() /var/www/site/library/Zend/View/Abstract.php:0 0.1365 7613744 
        23. Zend_View_Helper_HtmlElement->_htmlAttribs() /var/www/site/library/Zend/View/Helper/FormPassword.php:89 0.1365 7614364 
        24. implode() /var/www/site/library/Zend/View/Helper/HtmlElement.php:104 
    
    

    Can anyone tell why am i getting this error?

     

    And how can i solve it ?

     

     

        public function loginAction() {
            $obj = new Application_Form_Login();
    
            $request = $this->getRequest();
            if ($request->isPost()) {
                if ($obj->isValid($request->getPost())) {
                    if ($this->_process($obj->getValues())) {
                        $this->_helper->redirector('arcade', 'index');
                    }
                }
            }
            $this->view->form=$obj;
        }
    
    

    Login form =>

     

        <?php
        
        class Application_Form_Login extends Zend_Form
        {
        
            public function init()
            {
        		$this->setName("login");
        		$this->setMethod("post");
        
        		$temp=array(array('StringLength',false,array(0,50)));
        
        		$this->addElement('text','usr',array(
        			'filters'=>array('StringTrim','StringToLower'),
        			'validators'=>$temp,
        			'required'=>true,
        			'label'=>'Username',
        		));
        
        		$this->addElement('password','psw',array(
        			'filters'=>array('StringTrim'),
        			'validator'=>$temp,
        			'required'=>true,
        			'label'=>'Password',
        		));
        
        		$this->addElement('submit','log',array(
        			'required'=>false,
        			'ignore'=>true,
        			'label'=>'Login',
        		));
            }
        
        }

  2. I tried this:

    		$listyear = array();
    
    		for($i=2010;$i<=2020;$i++){
    			array_push($listyear,array($i => $i));
    		}
    

     

    Array
    (
        [0] => Array
            (
                [2010] => 2010
            )
    
        [1] => Array
            (
                [2011] => 2011
            )
    
        [2] => Array
            (
                [2012] => 2012
            )
    
        [3] => Array
            (
                [2013] => 2013
            )
    
        [4] => Array
            (
                [2014] => 2014
            )
    
        [5] => Array
            (
                [2015] => 2015
            )
    
        [6] => Array
            (
                [2016] => 2016
            )
    
        [7] => Array
            (
                [2017] => 2017
            )
    
        [8] => Array
            (
                [2018] => 2018
            )
    
        [9] => Array
            (
                [2019] => 2019
            )
    
        [10] => Array
            (
                [2020] => 2020
            )
    
    )
    

     

    But i want in this format :

    Array(
    [2010] = 2010
    [2011] = 2011
    ........
    )
    

  3. mysql> describe acos;
    +-------------+--------------+------+-----+---------+----------------+
    | Field       | Type         | Null | Key | Default | Extra          |
    +-------------+--------------+------+-----+---------+----------------+
    | id          | int(10)      | NO   | PRI | NULL    | auto_increment |
    | parent_id   | int(10)      | YES  |     | NULL    |                |
    | model       | varchar(255) | YES  |     | NULL    |                |
    | foreign_key | int(10)      | YES  |     | NULL    |                |
    | alias       | varchar(255) | YES  |     | NULL    |                |
    | lft         | int(10)      | YES  |     | NULL    |                |
    | rght        | int(10)      | YES  |     | NULL    |                |
    +-------------+--------------+------+-----+---------+----------------+
    7 rows in set (0.00 sec)
    
    mysql> describe aros;
    +-------------+--------------+------+-----+---------+----------------+
    | Field       | Type         | Null | Key | Default | Extra          |
    +-------------+--------------+------+-----+---------+----------------+
    | id          | int(10)      | NO   | PRI | NULL    | auto_increment |
    | parent_id   | int(10)      | YES  |     | NULL    |                |
    | model       | varchar(255) | YES  |     | NULL    |                |
    | foreign_key | int(10)      | YES  |     | NULL    |                |
    | alias       | varchar(255) | YES  |     | NULL    |                |
    | lft         | int(10)      | YES  |     | NULL    |                |
    | rght        | int(10)      | YES  |     | NULL    |                |
    +-------------+--------------+------+-----+---------+----------------+
    7 rows in set (0.00 sec)
    
    mysql> describe aros_acos;
    +---------+------------+------+-----+---------+----------------+
    | Field   | Type       | Null | Key | Default | Extra          |
    +---------+------------+------+-----+---------+----------------+
    | id      | int(10)    | NO   | PRI | NULL    | auto_increment |
    | aro_id  | int(10)    | NO   | MUL | NULL    |                |
    | aco_id  | int(10)    | NO   |     | NULL    |                |
    | _create | varchar(2) | NO   |     | 0       |                |
    | _read   | varchar(2) | NO   |     | 0       |                |
    | _update | varchar(2) | NO   |     | 0       |                |
    | _delete | varchar(2) | NO   |     | 0       |                |
    +---------+------------+------+-----+---------+----------------+
    7 rows in set (0.00 sec)
    

     

    How are acos,aros table created?

    Why are the table structures like that?

    mysql> select * from aros;
    +----+-----------+-------+-------------+-------+------+------+
    | id | parent_id | model | foreign_key | alias | lft  | rght |
    +----+-----------+-------+-------------+-------+------+------+
    |  1 |      NULL | Group |           1 | NULL  |    1 |    2 |
    |  2 |      NULL | Group |           2 | NULL  |    3 |    4 |
    |  3 |      NULL | Group |           3 | NULL  |    5 |    6 |
    |  4 |      NULL | Group |           4 | NULL  |    7 |    8 |
    |  5 |      NULL | Group |           5 | NULL  |    9 |   10 |
    |  6 |      NULL | Group |           6 | NULL  |   11 |   12 |
    |  7 |      NULL | Group |           7 | NULL  |   13 |   14 |
    |  8 |      NULL | Group |           8 | NULL  |   15 |   16 |
    |  9 |      NULL | Group |           9 | NULL  |   17 |   18 |
    | 10 |      NULL | Group |          10 | NULL  |   19 |   22 |
    | 11 |      NULL | Group |          11 | NULL  |   23 |   24 |
    | 12 |      NULL | Group |          12 | NULL  |   25 |   28 |
    | 13 |      NULL | Group |          13 | NULL  |   29 |   30 |
    | 14 |      NULL | User  |           1 | NULL  |   31 |   32 |
    | 15 |      NULL | User  |           2 | NULL  |   33 |   34 |
    | 16 |      NULL | User  |           3 | NULL  |   35 |   36 |
    | 17 |        12 | User  |           4 | NULL  |   26 |   27 |
    | 18 |        10 | User  |           5 | NULL  |   20 |   21 |
    +----+-----------+-------+-------------+-------+------+------+
    18 rows in set (0.02 sec)
    
    mysql> select * from acos;
    +----+-----------+-------+-------------+-------------+------+------+
    | id | parent_id | model | foreign_key | alias       | lft  | rght |
    +----+-----------+-------+-------------+-------------+------+------+
    |  1 |      NULL | NULL  |        NULL | controllers |    1 |    2 |
    +----+-----------+-------+-------------+-------------+------+------+
    1 row in set (0.00 sec)
    
    mysql> select * from aros_acos;
    Empty set (0.00 sec)
    

    Can someone please explain how it works?

     

    I can setup user authentication and after successfull authentication it will allow/deny some actions for controllers.

    So why do we need acl? And when is acl needed/must?

     

    Can't understand the concept of acl.

    I have read the article from cakephp book.

     

  4. function &getInstance($boot = true) {
    	static $instance = array();
    	if (!$instance) {
    		if (!class_exists('Set')) {
    			require LIBS . 'set.php';
    		}
    		$instance[0] =& new Configure();
    		$instance[0]->__loadBootstrap($boot);
    	}
    	return $instance[0];
    }
    

    Why is & there? function &getInstance

    And is it php4 syntax using the & ?$instance[0] =& new Configure();

  5. why does my mysql_num_rows always give the same err

    Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp2\www\e_commerce\e_commerce\admin\viewProducts.php on line 8

     

    $conn= mysql_connect("localhost","root","");
    mysql_select_db("ecommerce",$conn);
    $product_list="";
    $sql = "SELECT * FORM products";
    $query = mysql_query($sql,$conn);
    $exist = mysql_num_rows($query);
    

    although the very same code is running fine in another file of the same project.

    Please help me.

     

    So what was the error ?

  6. Ok I'm having an issue with a simple PHP Inlcude that I've never ran in to before. Maybe you guys can help.

    I'm trying to include a picture simply titled 'promo1.jpg'.. I go about the normal PHP include way with this code:

    <?php include $_SERVER['DOCUMENT_ROOT'] . '/images/promo1.jpg'; ?>

    This proceeds to only output a question mark '?'. No error message. Nothing else. Just the server saying "What the hell?". I've tried not doing the DOCUMENT_ROOT route and tried more locally but still same '?'. Any ideas on this one? Any help is appreciated, thanks.

     

    You can't include an image.

    You have to echo image inside a html image tag.

    That was simple.

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