Phpfr3ak Posted October 12, 2010 Share Posted October 12, 2010 Hi, fairly new to php, can't seem to figure out why this isn't working, it did before i added the $level_type aspect in... which i need to work with the way ive changed my script, any ideas as to why its not working? if ($token == $_SESSION['token']){ $sql = "SELECT * FROM skills WHERE id=$sid"; $que = mysql_query($sql) or die(mysql_error()); $res = mysql_fetch_array($que); //code goes here if ($playerdata['$level_type'] < $res['level_req']) { echo "You don't have the required level to learn this skill<br><br><a href='doresearch.php?sid=$res[id]'>Return to skill points!</a>"; } else { Link to comment https://forums.phpfreaks.com/topic/215659-any-clues/ Share on other sites More sharing options...
Pikachu2000 Posted October 12, 2010 Share Posted October 12, 2010 You've neglected to say what the actual problem is. Link to comment https://forums.phpfreaks.com/topic/215659-any-clues/#findComment-1121290 Share on other sites More sharing options...
Phpfr3ak Posted October 12, 2010 Author Share Posted October 12, 2010 It's echoing You don't have the required level to learn this skill, but i don't see as why... Link to comment https://forums.phpfreaks.com/topic/215659-any-clues/#findComment-1121300 Share on other sites More sharing options...
optikalefx Posted October 12, 2010 Share Posted October 12, 2010 its echoing because the value of $playerdata['$level_type'] is less than the value of $res['level_req'] Most likely those values aren't what you are expecting them to be. Check those guys separately. Link to comment https://forums.phpfreaks.com/topic/215659-any-clues/#findComment-1121304 Share on other sites More sharing options...
kenrbnsn Posted October 12, 2010 Share Posted October 12, 2010 Lose the single quotes from <?php$playerdata['$level_type']?> just use <?php$playerdata[$level_type]?> Variables contained in strings delimited by single quotes are not expanded. Ken Link to comment https://forums.phpfreaks.com/topic/215659-any-clues/#findComment-1121305 Share on other sites More sharing options...
Phpfr3ak Posted October 12, 2010 Author Share Posted October 12, 2010 I think ive found the issue i think its something along the lines of; if ($playerdata($res[$level_type]) < $res['level_req']) { Yet its not working any ideas? :s sorry im really crummy at php atm trying to gather the basics Link to comment https://forums.phpfreaks.com/topic/215659-any-clues/#findComment-1121308 Share on other sites More sharing options...
aleX_hill Posted October 12, 2010 Share Posted October 12, 2010 $sql = "SELECT * FROM skills WHERE id='$sid'"; --> include quotes around '$sid' and see if that changes things. Link to comment https://forums.phpfreaks.com/topic/215659-any-clues/#findComment-1121323 Share on other sites More sharing options...
kenrbnsn Posted October 12, 2010 Share Posted October 12, 2010 If the id field is numeric, you shouldn't have quotes around the value. Ken Link to comment https://forums.phpfreaks.com/topic/215659-any-clues/#findComment-1121324 Share on other sites More sharing options...
BlueSkyIS Posted October 12, 2010 Share Posted October 12, 2010 i prefer to quote EVERY value. that way, there is never a question to quote or not. is there a reason to not quote numbers? Link to comment https://forums.phpfreaks.com/topic/215659-any-clues/#findComment-1121334 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.