Hello,
I hope you can help me, been trying to solve this for hours.
I have 2 tables:
stoverview
and
stproducts
Both have the same primary key fireld: productid
I want to display on my page all items from table stproducts where they have a matching item in table st overview
for instance, table stoverview has 5 items
product id:
1
2
5
20
30
My table stproducts has 2000 items in it, but I only want to retrieve the results form that table where the productid number is also listed in teh stoverview table.
So, I should return 5 records out of that table.
I have tried all sorts of recordsets. no luck.
my closest result has been:
$query_rs_overview = "SELECT * FROM stoverview";
$rs_overview = mysql_query($query_rs_overview, $to_octo) or die(mysql_error());
$row_rs_overview = mysql_fetch_assoc($rs_overview);
$totalRows_rs_overview = mysql_num_rows($rs_overview);
$prod_id = $row_rs_overview['productid'];
mysql_select_db($database_to_octo, $to_octo);
$query_rs_product = "SELECT * FROM stproducts WHERE stproducts.productid = '".$prod_id."'";
$rs_product = mysql_query($query_rs_product, $to_octo) or die(mysql_error());
$row_rs_product = mysql_fetch_assoc($rs_product);
$totalRows_rs_product = mysql_num_rows($rs_product);
but when I loop my table to retrieve all results, only the first one comes up...
Can you please help?
Many thanks,
Vinny