basically i am trying to create an online storefront. i have three seperate tables where which i want to show on the page. three table are linked to one table called Smart. when i execute the code and try to click on the category only one out of three of the tables show the others show tell me no records to show when they actually have data in them can some one please help. here's the code.
[PHP]$display_block = "<h1>Smartegori es</h1>
<p>select Smart to see items.</p>";
$get_Smarts = "SELECT Smart_ID, Smart_title, Smart_descripti on
FROM Smart
ORDER BY Smart_title";
$get_Smart_res = mysql_query ($get_Smarts) or die (mysql_error()) ;
if (mysql_num_rows ($get_Smart_res ) < 1) {
$display_block = "<p><em>Sor ry no Smarts to browse</em></p>";
} else {
while ($Smarts = mysql_fetch_arr ay ($get_Smart_res )) {
$Smart_ID = $Smarts [Smart_ID];
$Smart_title = strtoupper (stripslashes ($Smarts[Smart_title]));
$Smart_desc = stripslashes ($Smarts [Smart_descripti on]);
$display_block .= "<p><strong >
<a href=\"$_SERVER[PHP_SELF]?Smart_ID=$Smar t_ID\">$Smart_t itle</a></strong>
<br>$Smart_desc </p>";
if ($_GET[Smart_ID] == $Smart_ID) {
$get_suits = "SELECT Suit_ID, Suit_Brand, Suit_Price FROM
Suits WHERE Smart_ID = '$Smart_ID'
ORDER BY Suit_Brand";
$get_suit_res = mysql_query ($get_suits) or die (mysql_error()) ;
if (mysql_num_rows ($get_suit_res) < 1 ) {
$display_block = "<p><em>Sor ry no items in this Smart</em></p>";
} else {
$display_block .= "<ul>";
while ($Suits = mysql_fetch_arr ay($get_suit_re s)) {
$Suit_id = $Suits[Suit_ID];
$Suit_title = stripslashes($S uits[Suit_Brand]);
$Suit_price = $Suits[Suit_Price];
$display_block .= "<li>
<a href=\"showitem .php?Suit_ID=$S uit_id\">$Suit_ title</a>
</strong> (£$Suit_price)" ;
}
$display_block .= "<ul>";
}
$get_shirts = "SELECT shirt_ID, shirt_Brand, shirt_Price FROM
shirts WHERE Smart_ID = '$Smart_ID'
ORDER BY shirt_Brand";
$get_shirt_res = mysql_query ($get_shirts) or die (mysql_error()) ;
if (mysql_num_rows ($get_shirt_res ) < 1 ) {
$display_block = "<p><em>Sor ry no items in this Smart</em></p>";
} else {
while ($shirts = mysql_fetch_arr ay($get_shirt_r es)) {
$shirt_id = $shirts[shirt_ID];
$shirt_title = stripslashes($s hirts[shirt_Brand]);
$shirt_price = $shirts[shirt_Price];
$display_block .= "<li>
<a href=\"showitem .php?shirt_ID=$ shirt_id\">$shi rt_title</a>
</strong> (£$shirt_price) ";
}
$display_block .= "<ul>";
}
$get_Trousers = "SELECT Trouser_ID, Trouser_Brand, Trouser_Price FROM
Trousers WHERE Smart_ID = '$Smart_ID'
ORDER BY Trouser_Brand";
$get_Trouser_re s = mysql_query ($get_Trousers) or die (mysql_error()) ;
if (mysql_num_rows ($get_Trouser_r es) < 1 ) {
$display_block = "<p><em>Sor ry no items in this Smart</em></p>";
} else {
while ($Trousers = mysql_fetch_arr ay($get_Trouser _res)) {
$Trouser_id = $Trousers[Trouser_ID];
$Trouser_title = stripslashes($T rousers[Trouser_Brand]);
$Trouser_price = $Trousers[Trouser_Price];
$display_block .= "<li>
<a href=\"showitem .php?Trouser_ID =$Trouser_id\"> $Trouser_title</a>
</strong> (£$Trouser_pric e)";
}
$display_block .= "<ul>";
}
}
}
}
?>[/PHP]
I am desperate as time is running out for me. any help would be greatly appreciated.
[PHP]$display_block = "<h1>Smartegori es</h1>
<p>select Smart to see items.</p>";
$get_Smarts = "SELECT Smart_ID, Smart_title, Smart_descripti on
FROM Smart
ORDER BY Smart_title";
$get_Smart_res = mysql_query ($get_Smarts) or die (mysql_error()) ;
if (mysql_num_rows ($get_Smart_res ) < 1) {
$display_block = "<p><em>Sor ry no Smarts to browse</em></p>";
} else {
while ($Smarts = mysql_fetch_arr ay ($get_Smart_res )) {
$Smart_ID = $Smarts [Smart_ID];
$Smart_title = strtoupper (stripslashes ($Smarts[Smart_title]));
$Smart_desc = stripslashes ($Smarts [Smart_descripti on]);
$display_block .= "<p><strong >
<a href=\"$_SERVER[PHP_SELF]?Smart_ID=$Smar t_ID\">$Smart_t itle</a></strong>
<br>$Smart_desc </p>";
if ($_GET[Smart_ID] == $Smart_ID) {
$get_suits = "SELECT Suit_ID, Suit_Brand, Suit_Price FROM
Suits WHERE Smart_ID = '$Smart_ID'
ORDER BY Suit_Brand";
$get_suit_res = mysql_query ($get_suits) or die (mysql_error()) ;
if (mysql_num_rows ($get_suit_res) < 1 ) {
$display_block = "<p><em>Sor ry no items in this Smart</em></p>";
} else {
$display_block .= "<ul>";
while ($Suits = mysql_fetch_arr ay($get_suit_re s)) {
$Suit_id = $Suits[Suit_ID];
$Suit_title = stripslashes($S uits[Suit_Brand]);
$Suit_price = $Suits[Suit_Price];
$display_block .= "<li>
<a href=\"showitem .php?Suit_ID=$S uit_id\">$Suit_ title</a>
</strong> (£$Suit_price)" ;
}
$display_block .= "<ul>";
}
$get_shirts = "SELECT shirt_ID, shirt_Brand, shirt_Price FROM
shirts WHERE Smart_ID = '$Smart_ID'
ORDER BY shirt_Brand";
$get_shirt_res = mysql_query ($get_shirts) or die (mysql_error()) ;
if (mysql_num_rows ($get_shirt_res ) < 1 ) {
$display_block = "<p><em>Sor ry no items in this Smart</em></p>";
} else {
while ($shirts = mysql_fetch_arr ay($get_shirt_r es)) {
$shirt_id = $shirts[shirt_ID];
$shirt_title = stripslashes($s hirts[shirt_Brand]);
$shirt_price = $shirts[shirt_Price];
$display_block .= "<li>
<a href=\"showitem .php?shirt_ID=$ shirt_id\">$shi rt_title</a>
</strong> (£$shirt_price) ";
}
$display_block .= "<ul>";
}
$get_Trousers = "SELECT Trouser_ID, Trouser_Brand, Trouser_Price FROM
Trousers WHERE Smart_ID = '$Smart_ID'
ORDER BY Trouser_Brand";
$get_Trouser_re s = mysql_query ($get_Trousers) or die (mysql_error()) ;
if (mysql_num_rows ($get_Trouser_r es) < 1 ) {
$display_block = "<p><em>Sor ry no items in this Smart</em></p>";
} else {
while ($Trousers = mysql_fetch_arr ay($get_Trouser _res)) {
$Trouser_id = $Trousers[Trouser_ID];
$Trouser_title = stripslashes($T rousers[Trouser_Brand]);
$Trouser_price = $Trousers[Trouser_Price];
$display_block .= "<li>
<a href=\"showitem .php?Trouser_ID =$Trouser_id\"> $Trouser_title</a>
</strong> (£$Trouser_pric e)";
}
$display_block .= "<ul>";
}
}
}
}
?>[/PHP]
I am desperate as time is running out for me. any help would be greatly appreciated.
Comment