troubleshooting Question

PHP SQL LOOKUP

Avatar of MPDenver
MPDenver asked on
PHP
7 Comments1 Solution377 ViewsLast Modified:
Im using the following function to pull records for a dropdown. The dropdown is working however the results are not what I am looking for.

I cant get the NOT IN to work below its just displaying all the records in "$strTableName " and not removing the matching field "onetimeID" in the picksummary table..

Any advice would be greatfull.

Thanks

function OneTimedropdown($intIdField, $strNameField, $strTableName, $strNameOrdinal, $strOrderField, $userID, $strMethod="asc") {
   
   echo "<select name=\"$strNameOrdinal\">\n";
   echo "<option value=\"NULL\">".$strMaskName."</option>\n";
   
   
   $strQuery = "select $intIdField, $strNameField
            from $strTableName
                 WHERE $strNameField NOT IN (select onetimeID FROM nflp_picksummary where userID = '" . $user->userID . "')";
                        
   $rsrcResult = mysql_query($strQuery);

   while($arrayRow = mysql_fetch_assoc($rsrcResult)) {
      $strA = $arrayRow["$intIdField"];
      $strB = $arrayRow["$strNameField"];
      echo "<option value=\"$strA\">$strB</option>\n";
   }

   echo "</select>";
}
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 7 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros