Php Error Help!

Discussion in 'PHP' started by IshanFdo, Oct 25, 2011.

Thread Status:
Not open for further replies.
  1. #1
    This Is the Error :-

    Parse error: syntax error, unexpected ']', expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/a4080554/public_html/application/models/applicationmodel.php on line 98

    Here's The Code :-

    <?php
    
    /**
     * User Model
     *
     *
     * @copyright Copyright (c) 2008 [x-MoBiLe] Nulled
     * @license
     * @since 1/2/2008
     */
    ini_set('display_errors', 1);
    error_reporting(E_ALL);
       class Applicationmodel extends Model
       {
            //Constructor
            function Applicationmodel()
            {
                    parent::Model();
            }
            function getApplications($onlyBasic = false)
            {
                    if ($onlyBasic == true) $appQuery = $this->db->query('SELECT * FROM applications WHERE user_id=0');
                    else  $appQuery = $this->db->query('SELECT * FROM applications');
                    if ($appQuery->num_rows() > 0)
                    {
                            $applications = array();
                            foreach ($appQuery->result_array() as $appRow)
                            {
                                    $applications[$appRow['application_id']] = $appRow;
                            }
                            return $applications;
                    }
                    else  return false;
            }
            function getUserApplications()
            {
                    $this->db->select('application_ids');
                    $this->db->where('user_id', $this->session->userdata('user_id'));
                    $this->db->limit(1, 0);
                    $userAppQuery = $this->db->get('users_applications');
                    if ($userAppQuery->num_rows() > 0)
                    {
                            $userAppRow = $userAppQuery->result_array();
                            $appQuery = $this->db->query('SELECT * FROM applications WHERE application_id IN (' . $userAppRow[0]['application_ids'] . ')');
                            if ($appQuery->num_rows() > 0)
                            {
                                    $applications = array();
                                    foreach ($appQuery->result_array() as $appRow)
                                    {
                                            $applications[$appRow['application_id']] = $appRow;
                                    }
                                    return $applications;
                            }
                            else  return false;
                    }
                    else  return false;
            }
            function isApplication($appName)
            {
                    $this->db->where('application_name', $appName);
                    $this->db->limit(1, 0);
                    $appQuery = $this->db->get('applications');
                    if ($appQuery->num_rows() > 0)
                    {
                            $appRow = $appQuery->result_array();
                            return $appRow[0]['application_id'];
                    }
                    else  return false;
            }
            function isUserCanAccessTheApplication($applicationId)
            {
                    $this->db->select('application_ids');
                    $this->db->where('user_id', $this->session->userdata('user_id'));
                    $this->db->limit(1, 0);
                    $userAppQuery = $this->db->get('users_applications');
                    if ($userAppQuery->num_rows() > 0)
                    {
                            $userAppRow = $userAppQuery->result_array();
                            $userAppArray = explode(',', $userAppRow[0]['application_ids']);
                            if (array_search($applicationId, $userAppArray) === false) return false;
                            else  return true;
                    }
                    else  return false;
            }
            function getLanguages()
            {
                    $this->db->select('lang_code, lang_name');
                    $this->db->from('languages');
                    $langQuery = $this->db->get();
                    $languages = array();
                    echo "</pre>";
                    print_r($appQuery);
                    echo" </pre>
                    if ($langQuery->num_rows() > 0)
                    {
                            foreach ($langQuery->result_array[] as $langRow)
                            {
                                    $languages[] = $langRow;
                            }
                    }
                    return $languages[];
            }
    }
    
     ?>
    PHP:
    And line 98 Is
    $languages[] = $langRow;
    PHP:
    And This Is a Facebook Clone Script!
    Reply Plz
     
    Last edited: Oct 25, 2011
    IshanFdo, Oct 25, 2011 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,899
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #2
    change
     foreach ($langQuery->result_array[] as $langRow)
    PHP:
    to
     foreach ($langQuery->result_array as $langRow)
    PHP:
     
    sarahk, Oct 26, 2011 IP
  3. IshanFdo

    IshanFdo Greenhorn

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #3
    Man Its The Error About Line 98.Line 98 Is
    $languages[] = $langRow;
    PHP:
     
    IshanFdo, Oct 26, 2011 IP
  4. IshanFdo

    IshanFdo Greenhorn

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #4
    I Removed The [] Things And Now This Error Is Cming!
    Parse error: syntax error, unexpected $end in /home/a4080554/public_html/application/models/applicationmodel.php on line 105
    Code (markup):
    And The Line 105 Is Blank!
    Line 100 = }
    Line 101 = return $languages;
    Line 102 = }
    Line 103= }
    Line 104 = (Blank)
    Line 105 = ?>

    So Whats The Wrong The Line is Blank Man!
     
    Last edited: Oct 26, 2011
    IshanFdo, Oct 26, 2011 IP
  5. sarahk

    sarahk iTamer Staff

    Messages:
    28,899
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #5
    take the [] out of the return line too

    return $languages;
    PHP:
    $languages[] will put a new row in the array but you're asking it to return something that isn't created yet so its getting all confused.

    returning $languages will send the entire array back to the script that called it.
     
    sarahk, Oct 26, 2011 IP
  6. IshanFdo

    IshanFdo Greenhorn

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #6
    Yaa.Took It Out But Still The Error Is There.


    Now the Code Is
    		function getLanguages()
    		{
    				$this->db->select('lang_code, lang_name');
    				$this->db->from('languages');
    				$langQuery = $this->db->get();
    				$languages = array();
    				echo "</pre>";
                    print_r($appQuery);
                    echo" </pre>
    				if ($langQuery->num_rows() > 0)
    				{
    						foreach ($langQuery->result_array as $langRow)
    						{
    								$languages = $langRow;
    						}
    				}
    						return $languages;		
    		}
    }
    
    ?>
    PHP:
     
    Last edited: Oct 26, 2011
    IshanFdo, Oct 26, 2011 IP
  7. sarahk

    sarahk iTamer Staff

    Messages:
    28,899
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #7
    This lines
    $languages[] = $langRow;
    PHP:
    still needs the square brackets because we are adding $langRow to the array. Its the foreach and return lines that don't need the square brackets.
     
    sarahk, Oct 26, 2011 IP
  8. IshanFdo

    IshanFdo Greenhorn

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #8
    Man Now The Error Is

    Parse error: syntax error, unexpected ']', expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/a4080554/public_html/application/models/applicationmodel.php on line 98

    Code :
            {
                    $this->db->select('lang_code, lang_name');
                    $this->db->from('languages');
                    $langQuery = $this->db->get();
                    $languages = array();
                    echo "</pre>";
                    print_r($appQuery);
                    echo" </pre>
                    if ($langQuery->num_rows() > 0)
                    {
                            foreach ($langQuery->result_array as $langRow)
                            {
                                    $languages[] = $langRow;
                            }
                    }
                            return $languages;        
            }
    }
    PHP:
    Line 98 Is
    $languages[] = $langRow;
    PHP:
    Add me In Skype : k_a_i_f_
    Facebook :
     
    Last edited: Oct 26, 2011
    IshanFdo, Oct 26, 2011 IP
  9. sarahk

    sarahk iTamer Staff

    Messages:
    28,899
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #9
    Ok, for starters, I'm not a "man"

    have you done a var_dump of $langQuery->result_array to check that it contains what you expect?
     
    sarahk, Oct 26, 2011 IP
  10. IshanFdo

    IshanFdo Greenhorn

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #10
    Sorry For saying Man ( I Need To Make this Error )!

    And i didnt make that script I dnt even know a bit of php Plz help
     
    IshanFdo, Oct 26, 2011 IP
  11. sarahk

    sarahk iTamer Staff

    Messages:
    28,899
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #11
    Well you might need to learn some before you go editing scripts like this. Atleast looking up some of the syntax would be a good start.

    Have you been back to where you obtained the script and asked for support?



    Aaaah, just spotted this line

    * @copyright Copyright (c) 2008 [x-MoBiLe] Nulled
    PHP:
    Not cool. I'm out. I don't help people rip off my fellow coders. If I charged you for my time you'd spend more than you would buying a legitimate copy.
     
    sarahk, Oct 26, 2011 IP
  12. IshanFdo

    IshanFdo Greenhorn

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #12
    no I dnt need to know about php im still 12 years old!
    So can u make It?Check ur Inbox!
     
    IshanFdo, Oct 26, 2011 IP
  13. sarahk

    sarahk iTamer Staff

    Messages:
    28,899
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #13
    Lets spell it out in language that your 12 year old brain can understand. I know what 12 year olds are like. I've got one of my own.

    If you take something that isn't yours it is called stealing.
    If someone takes something and "nulls" it and then gives it to you, it's still stolen and you still shouldn't have it.

    Even if you do it online it is still theft.

    And you lied when you signed up for that facebook account because you have to be 13 to get an account legitimately. Your online life has started with lies, deception and theft. Not a good start and it will taint you for years to come.
     
    sarahk, Oct 26, 2011 IP
  14. IshanFdo

    IshanFdo Greenhorn

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #14
    Really?but I searched For A Script It was About $100 ?

    Ohh! Yea I Am A Stealer And A Liyer !

    How About If i use a Degugger ? Give me A link To it plz?
     
    Last edited: Oct 26, 2011
    IshanFdo, Oct 26, 2011 IP
Thread Status:
Not open for further replies.