Welcome Guest, Not a member yet? Register   Sign In
Sub request in where
#1

(This post was last modified: 12-27-2018, 04:15 PM by xenos92.)

Hello,
I come to you because I need help on request ...

I have a rank table that lists all the ranks available to a player with the maximum number of points for the rank.
I have another table users who list my players with their experience.

I want to use the experience of players to display the rank corresponding to the experience.

Example :

[b]rank table[/b]
|    id    |    grade    |    point    |
__________________________
|    1    |   Niveau 1  |     300    |
|    2    |   Niveau 2  |     600    |

users table
|    id    |    name    |    experience    |
______________________________
|    1    |      test      |     330             |


So if my player has an experience of 330 I need to display a level of 2 because above 300 and below 600.

PHP Code:
/*
// This works if I enter the experience value directly
$this->db->select('*')
            ->from('rank')
            ->where('point >=', 1200);
*/

// This not work I can't arrive to get the experience user
$this->db->select('*')
            ->
from('rank')
            ->
where('point >='"SELECT 'experience' FROM 'users' WHERE 'name' =  $username");


$query $this->db->get();

if(
$query->num_rows()>0)
{
    return 
$query->row_array();

Reply


Messages In This Thread
Sub request in where - by xenos92 - 12-27-2018, 04:14 PM
RE: Sub request in where - by php_rocs - 12-28-2018, 08:22 AM
RE: Sub request in where - by badger - 12-28-2018, 09:28 AM
RE: Sub request in where - by xenos92 - 12-28-2018, 09:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB