chocopi Posted June 2, 2007 Share Posted June 2, 2007 with my code it gives resource id# 16 or whatever it is and nomally to change it to the value i would use $blah = $row['name']; but for some reason it gives blank, but i know that it is not blank so heres my code: <?php $enemy_id = $_SESSION['enemy_id']; // Work out enemy drops $enemy_query = mysql_query("SELECT `drop1` FROM `Enemies` WHERE `id`='$enemy_id'"); $row = @mysql_fetch_assoc($enemy_query) or die("Invalid query, please contact an administrator!"); list($table1, $id1) = split("_", $row['drop1']); $array = array('Body','Hats','Items','Pants','Weapons'); sort($array); foreach ($array as $key => $table1) { $drop1 = "SELECT `id` FROM `$table1` WHERE `id`='$id1'"; $drop1 = mysql_query($drop1) or die(mysql_error() . ' ON Query ' . $drop1); } ?> Thanks, ~ Chocopi Quote Link to comment https://forums.phpfreaks.com/topic/54015-solved-resource-id/ Share on other sites More sharing options...
chocopi Posted June 2, 2007 Author Share Posted June 2, 2007 Nevermind it wasnt working as: <?php $enemy_id = $_SESSION['enemy_id']; // Work out enemy drops $enemy_query = mysql_query("SELECT `drop1` FROM `Enemies` WHERE `id`='$enemy_id'"); $row = @mysql_fetch_assoc($enemy_query) or die("Invalid query, please contact an administrator!"); list($table1, $id1) = split("_", $row['drop1']); $array = array('Body','Hats','Items','Pants','Weapons'); sort($array); foreach ($array as $key => $table1) { $drop1 = "SELECT `id` FROM `$table1` WHERE `id`='$id1'"; $drop1 = mysql_query($drop1) or die(mysql_error() . ' ON Query ' . $drop1); } ?> should have been <?php $enemy_id = $_SESSION['enemy_id']; // Work out enemy drops $enemy_query = mysql_query("SELECT `drop1` FROM `Enemies` WHERE `id`='$enemy_id'"); $row = @mysql_fetch_assoc($enemy_query) or die("Invalid query, please contact an administrator!"); list($table1, $id1) = split("_", $row['drop1']); $array = array('Body','Hats','Items','Pants','Weapons'); sort($array); foreach ($array as $key => $table1) { $drop1 = mysql_query("SELECT `id` FROM `$table1` WHERE `id`='$id1'"); $drop1 = mysql_fetch_assoc($drop1) or die(mysql_error() . ' ON Query ' . $drop1); $drop1 = $drop1['id']; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/54015-solved-resource-id/#findComment-267057 Share on other sites More sharing options...
paul2463 Posted June 2, 2007 Share Posted June 2, 2007 if the resource id #16 is returned and not the data then you have not made a fetch statement <?php $query = "SELECT * table "; $answer = mysql_query($query) of die ("Cannot get the stuff" . mysql_error()); echo $answer; //would output Resource id# 16 or some such number $row = mysql_fetch_row($answer); echo $row[0]; //would out put the first key in the row ?> Quote Link to comment https://forums.phpfreaks.com/topic/54015-solved-resource-id/#findComment-267061 Share on other sites More sharing options...
chocopi Posted June 2, 2007 Author Share Posted June 2, 2007 yea like a muppet, i had used a query instead Quote Link to comment https://forums.phpfreaks.com/topic/54015-solved-resource-id/#findComment-267071 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.