Using the same query twice
I've got a billing query, and then a billing result. How can I use the billing result twice? or can I? I mean is there a clean way of doing this or do I have to do 2 separate queries?
Here's the code in question:
$billingQuery = "SELECT * FROM Billing WHERE UID = '$userData[UID]'";
$billingResult = mysql_query($billingQuery)or die("#164;billingQuery error: ".mysql_error());
$billingCount = mysql_num_rows($billingResult);
while($billingData = mysql_fetch_array($billingResult)){
foreach($billingData as $key => $value){
echo "$key => $value <br>";
}
}
if($billingCount >= 1){
echo "<br>found $billingCount!! <br>";
// now the following array should have the same data as $billingData, but doesn't
$billingDataPrime = mysql_fetch_array($billingResult);
echo $billingDataPrime['Last_Pmt']."<br>";
}
The best ideas are not the simple ones, they're the complex ones made easy.
|