ELdin ELdin - 1 year ago 93
Javascript Question

PHP, Mysql experience needed

I'm working on one project, but im stopped becouse i got problem with one file or sql.
I'm not so experienced with mysql, so i come here to try find anyone who can help me to fix this.
The problem is next. I'm trying to make functionaly website about sport betting tips on this adress http://tipovi.esy.es/
Everything working, except one file.
When i login, and when i try to add TIP, it looks like this ( Picture link 1)

When i login, and when i try to add TIP, it looks like this in this picture( Picture link 2)

Now, when i need to SELECT sport, league, event i can't. It don't show nothing. Sems it need to get it from database. When i enter in database, there are's bases for League, Sport, Event and others. But something is wrong. That is my problem

The database looks like this ( Picture link 3 )

And the base for sport looks like this ( Picture link 4)

Now, maybe problem is in file create.php , i will attach the file, or screenshoot, to include everyhing, so if someone chosse to help me, will be easier like this.
I can't add more than 2 links, so i need to write like this :(

1 https://i.stack.imgur.com/bTNKq.png
2 qtBCS .png
3 CTr5z .png
4 R58JF .png

I will be so thankful if someone can help me to fix this thing. Thanks in advance
Ps: I can't add more links, so i will add in comment file create.php

Answer Source

For Select Sports field :

In your create() method under Tips controller like bellow :

Template::set('sports', $this->sports_model->get_tips_sports());

Some change your get_tips_sports() method in Sports_model like bellow :

function get_tips_sports()
    $this->db->select('sports.id, name,icon,sports.active');
    $this->db->join('events', 'events.sport_id  = sports.id', 'left');
    $this->db->where('sports.active', 1);
    $this->db->order_by('display_order', 'asc');
    $query = $this->db->get();
    return $query;

For Select League :

Just you change you get_leagues_by_sport_id($id) in League_model.php like bellow :

public function get_leagues_by_sport_id($id)
    $this->db->select('leagues.league_id, leagues.league_name, leagues.sport_id');
    $this->db->join('events', 'events.league_id  = leagues.league_id', 'left');
    $query = $this->db->get_where('leagues',array('leagues.sport_id'=>$id));

    $leagues = array();

        foreach ($query->result() as $league) {
            $leagues[$league->league_id] = $league->league_name;
        return $leagues;
        return FALSE;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download