Rookie Question - Database Call

Code Snippet -> http://codeshare.ulatu.com/febf82ac

[code]
$skillquery = mysql_query(“SELECT g.ID, g.user_id, ps.skillID, ps.skillValue, s.skillNAME, s.skillMAX
FROM game_members g INNER JOIN
playerSkill ps on g.user_id = ps.user_id INNER JOIN
skills s on ps.skillID = s.skillID
WHERE g.user_id = $user_id”);

$my_skill = $row[‘s.pickpocket’];[/code]

I’m having trouble with this code and I guess I’m too new to PHP to understand what the problem is.

I have two tables with a third relational table in the database and this script is trying to pull them all together for the data.

ANY help or recommendations would be helpful.

I’m not receiving any error.

Thanks,
n00b… :(

It may be worth noting that I do not have any data in the table currently.

This is for an RPG where the players have specific skills based on their actions.

Again, any help would be greatly appreciated.


$skillquery = mysql_query("SELECT g.ID, g.user_id, ps.skillID, ps.skillValue, s.skillNAME, s.skillMAX
FROM    game_members g INNER JOIN
        playerSkill ps on g.user_id = ps.user_id INNER JOIN
        skills s on ps.skillID = s.skillID
      WHERE g.user_id = $user_id");

$skill=mysql_fetch_array($skillquery);

  $my_skill = $skill['s.pickpocket'];

You needed to add the fetch code in there… depending on what you need, either use fetch_array or fetch_row

This is how i would probably do your code but mine might be unsecure or not correct


$skillquery = mysql_query("SELECT g.ID, g.user_id, ps.skillID, ps.skillValue, s.skillNAME, s.skillMAX
FROM    game_members g INNER JOIN
        playerSkill ps on g.user_id = ps.user_id INNER JOIN
        skills s on ps.skillID = s.skillID
      WHERE g.user_id = $user_id");

$skill=mysql_fetch_array($skillquery);

  $my_skill['s.pickpocket'];
Sponsor our Newsletter | Privacy Policy | Terms of Service