Joining tables
I am building a eCart shop that sells photographic prints. I am trying to get the location name to display in the product info.
I need to get the 'LocationName' (VARCHAR) from the 'Location' table using 'ImageLocation' (INT) from the 'Image' table.
I have tried doing it with a form variable (LocID) but can't get it to work!!
Here is my page: month.php?Month=1
This is my PHP on the page:
$colname_rsLocationName = "-1";
if (isset($_POST['LocID'])) {
$colname_rsLocationName = (get_magic_quotes_gpc()) ? $_POST['LocID'] : addslashes($_POST['LocID']);
}
mysql_select_db($database_connLandscapes365, $connLandscapes365);
$query_rsLocationName = sprintf("SELECT LocationName FROM Location WHERE LocationID = %s", GetSQLValueString($colname_rsLocationName, "int"));
$rsLocationName = mysql_query($query_rsLocationName, $connLandscapes365) or die(mysql_error());
$row_rsLocationName = mysql_fetch_assoc($rsLocationName);
$totalRows_rsLocationName = mysql_num_rows($rsLocationName);