When the code below is called, the admin has just logged in and is only supposed to see the products linked to his/her customer id number, or custid.
The admins table contains admins who have a unique adminid and a customer id, or custid. This custid number is associated with a unique customer (my clients) in the customers table. I’m using the customers table to ‘associate’ the admins to the customers.
I’m trying to make the php get the custid number by saying SELECT custid from customers (my clients table) where adminid=adminid (the admin id of the person who just logged in).
This code is pulling ALL the products from the products table, regardless of which admin is logged in. A serious problem. Any help is appreciated. Thanks.
[php]<?php
echo "<label><h3>Browse Procucts:<br></h3> </label><br>\n";
$query="SELECT custid from customers where adminid=adminid";
$result=mysql_query($query);
while($row=mysql_fetch_array($result,MYSQL_ASSOC))
{
$custid = $row['custid'];
$query2="SELECT count(prodid), productname FROM products WHERE custid = $custid";
$result2 = mysql_query($query2);
$row=mysql_fetch_array($result2);
$total = $row[0];
$entreename = $row['productname'];
echo "<a href=\"smalladmin.php?content=testpage&custid=$custid\">$productname</a> ($total)<br>\n";
}
?>[/php]