mrt003003 Posted April 27, 2011 Share Posted April 27, 2011 Hi there im left joining 3 tables and outputting the results.. Nothing is being out;putputted and Im getting an error: Notice: Undefined variable: row_Test in C:\wamp\www\SWB\ship.php on line 136 Call Stack # Time Memory Function Location 1 0.0014 408608 {main}( ) ..\ship.php:0 Ive tested the join in mysql and it works fine. Its just that on my webpage Nothing is outputted and only this one notice error appears. heres my join: <?php $colname_Test = "-1"; if (isset($_GET['recordID'])) { $colname_Test = (get_magic_quotes_gpc()) ? $_GET['recordID'] : addslashes($_GET['recordID']); } mysql_select_db($database_swb, $swb); $query_Test = sprintf("SELECT s.ShipID, s.FleetName, f.FleetName, f.PlanetName, p.PlanetName, p.PlayerName FROM Ships s LEFT JOIN Fleet f ON (s.FleetName = f.FleetName) LEFT JOIN Planet p ON (f.PlanetName = p.PlanetName) WHERE s.ShipID = '$colname_Ship'"); $Test = mysql_query($query_Test, $swb) or die(mysql_error()); $totalRows_Test = mysql_num_rows($Test); ?> echo $row_Test['PlanetName']; ?> Heres how my tables connect: ShipID (FleetName) ---> FleetName (PlanetName) ---> PlanetName, so im trying to detemine the fleet and planet the ship is on. Any ideas why its not working?? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/234912-undefined-variable/ Share on other sites More sharing options...
Pikachu2000 Posted April 27, 2011 Share Posted April 27, 2011 Where do you actually define $row_Test? You seem to be missing a mysql_fetch_assoc() in that code . . . Quote Link to comment https://forums.phpfreaks.com/topic/234912-undefined-variable/#findComment-1207250 Share on other sites More sharing options...
mrt003003 Posted April 27, 2011 Author Share Posted April 27, 2011 Yes brilliant, thank you! Ive been staring at my code of ages and i couldnt see the obvious thanks again Quote Link to comment https://forums.phpfreaks.com/topic/234912-undefined-variable/#findComment-1207259 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.