if statement being weird
Posted: Thu Jun 12, 2008 1:30 pm
To see the detail page you can click on the link or type in the style number in the search form. If you type in the style number in the search form everything works great but if you click on a link you get this error at the top of the page:
Notice: Undefined index: fromSearch in C:\webserver\Apache2\htdocs\pacificHeadwear2008\product_detail.php on line 8
but everything still shows up correctly below that. Can anyone tell me why this is happening. Here is the code that is breaking starting at line 8:
Notice: Undefined index: fromSearch in C:\webserver\Apache2\htdocs\pacificHeadwear2008\product_detail.php on line 8
but everything still shows up correctly below that. Can anyone tell me why this is happening. Here is the code that is breaking starting at line 8:
Code: Select all
if($_REQUEST['fromSearch'] != "") {
mysql_select_db($database_dbConn, $dbConn);
$query_rsProducts = "SELECT products.id as pid, series.name as series, products.model as model, products.name as name,
products.is_New as new, products.profile_material as profile, products.crown, products.visor,
products.sweatband as sweatband, products.sizes as sizes, products.closure as closure,
products.unit_price as price, products.notes
FROM products JOIN series ON series.id = products.series_id
WHERE products.model LIKE '".$_REQUEST['fromSearch']."%'";
$rsProducts = mysql_query($query_rsProducts, $dbConn) or die(mysql_error());
$row_rsProducts = mysql_fetch_assoc($rsProducts);
$totalRows_rsProducts = mysql_num_rows($rsProducts);
$pid = $row_rsProducts['pid'];
} else {
mysql_select_db($database_dbConn, $dbConn);
$query_rsProducts = "SELECT products.id as pid, series.id as sid, series.name as series, products.model as model, products.name as name,
products.is_New as new, products.profile_material as profile, products.crown, products.visor,
products.sweatband as sweatband, products.sizes as sizes, products.closure as closure,
products.unit_price as price, products.notes
FROM products JOIN series ON series.id = products.series_id
WHERE products.id = '".$_REQUEST['pid']."'";
$rsProducts = mysql_query($query_rsProducts, $dbConn) or die(mysql_error());
$row_rsProducts = mysql_fetch_assoc($rsProducts);
$totalRows_rsProducts = mysql_num_rows($rsProducts);
$pid = $row_rsProducts['pid'];
}