Jump to content

Undefined index


mrt003003

Recommended Posts

Hi there i keep getting an error: Notice: Undefined index: ShipYard in C:\wamp\www\SWB2\test3.php on line 160

 

Heres the relevant select query:

// COUNT SHIPYARDS
$colname_shipyard = 'Empire';

mysql_select_db($database_swb, $swb);
$query_shipyard = sprintf("SELECT SUM(ShipYard) FROM planet WHERE PlayerName = %s", GetSQLValueString($colname_shipyard, "text"));
$shipyard = mysql_query($query_shipyard, $swb) or die(mysql_error());
$row_shipyard = mysql_fetch_assoc($shipyard);
$totalRows_shipyard = mysql_num_rows($shipyard);

 

The error is pointing to:

echo $row_shipyard['ShipYard'];

Im a bit of a noob and have tried changing to:

echo $row['ShipYard'];

When i do this i get a different error: Notice: Undefined variable: row in C:\wamp\www\SWB2\test3.php on line 159

 

The row ShipYard is in a table called planet but its not suppose to be  indexed or unique.

 

Am I missing something here??

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/238135-undefined-index/
Share on other sites

Archived

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.