Jump to content

Undefined variable


Recommended Posts

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??



Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.