Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Im passing a variable called $Categ

Status
Not open for further replies.

Aeros

Programmer
Joined
Oct 7, 2002
Messages
166
Location
US
Im passing a variable called $CategoryID to this page and running a query to pull all records where this value matches a record called 'intProdGroupID'. The value is getting passed but I am getting no results and im not sure exactly why. Any help is greatly appreciated.



<?php require_once('Connections/todaysmotherSQL.php'); ?>
<?php
mysql_select_db($database_todaysmother, $todaysmother);
$query_SearchResults = &quot;SELECT intProdID, varProdName, varProdDesc, varProdImage, varProdPrice, intProdGroupID FROM Products WHERE intProdGroupID = '$CategoryID'&quot;;
$SearchResults = mysql_query($query_SearchResults, $todaysmother) or die(mysql_error());
$row_SearchResults = mysql_fetch_assoc($SearchResults);
$totalRows_SearchResults = mysql_num_rows($SearchResults);
?>
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body>
Results:<br>
passed: <?php print(&quot;$searchParam - $CategoryID&quot;); ?>
<?php echo $row_SearchResults['varProdName']; ?>

<?
while(list($varProdName) = mysql_fetch_row($SearchResults)){
echo &quot;$varProdName</BR>&quot;;
}
?>

</body>
</html>
<?php
mysql_free_result($SearchResults);
?>
 
I'm pretty new to PHP so this may be way out in left field, but one thing I thought I discovered in some initial playing around was that once you fetch the row into an array, it doesn't seem to play nice after that. You're running a fetch_assoc and fetch_row on the same recordset. Like I say, I may have been hallucenating, but I thought when I tried that, the second time around always came up empty.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top