If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > while loop only queries once...plz help

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-18-04, 10:44
shivers3000 shivers3000 is offline
Registered User
 
Join Date: May 2004
Posts: 1
while loop only queries once...plz help

Can someone explain why the $displayResults will not query twice?

Scripts Objective:
to take a car's VIN retrieve the car info and display in nice rows

Issue with Script:
The while loop displays the first car's information fine but on the second loop it will does not run the query for $displayResults, all though the $queryDisplayResults does change the car's Vehicle ID Number

What am I not doing right?

db_connect();
while ($row1 = mysql_fetch_assoc($searchMatches))
{
$queryDisplayResults = "select userautoconnect.varAutoID, carinfo.varYear, carinfo.varModel, carinfo.intMakeID, carinfo.intPrice, carinfo.intMileage, autodescription.blobDescription FROM carinfo, autodescription, userautoconnect WHERE ". $row1['varAutoID']." = userautoconnect.varAutoID && userautoconnect.varAutoID = carinfo.varAutoID && userautoconnect.varAutoID = autodescription.varAutoID";


$displayResults = mysql_query($queryDisplayResults);

$displayMatchesX10 = mysql_num_rows($displayResults);

$row = mysql_fetch_assoc($displayResults);

//|||||||||||||||||||||||||||||||||||||||||Declare variable to print Car maker ||||||||||||||||||||
$make = $row['intMakeID'];
$carMaker = getCarDefinition('definitioncar', 'intMakeID', $make);

echo " <A HREF= moreInfo.php?vin=".$row['varAutoID'].">";
echo "<tr VALIGN='top' bgcolor='#F5F5F7' style='cursor:hand'; onmouseOver= this.bgColor='#F0EF3C'; onmouseOut=this.bgColor='#F5F5F7'; >";


echo "<TD WIDTH='50px' HEIGHT= '30px' ALIGN='center'>";

echo "<P CLASS=searchResultsHeadings>Photo</P>";

echo "</TD>";
echo "<TD WIDTH='50px' ALIGN='center'>";

echo $row['varYear'];
echo "</TD>";

echo " <TD WIDTH='241px' ALIGN='center'>";
echo $carMaker."&nbsp;&nbsp;". $row['varModel'];
echo "</TD>";

echo "<TD WIDTH='60px' ALIGN='center'>";
echo $row['intMileage'];
echo "</TD>";

echo "<TD WIDTH='60px' ALIGN='center'>";
echo $row['intPrice'];

echo " </TD>";
echo "</TR></A> ";
mysql_free_result($displayResults);
}
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On