Hello, I am trying to run 1 query then another query. It appears like the second query is returning the same data as the first. is there some kind of flush that needs to be done? thanks $query = "SELECT address, city, state, zip, depot FROM store WHERE store='$store'"; $result1 = mysql_query($query) or die ('Invalid Query - Cannot retrieve equipment Type' .mysql_error() ); $row=mysql_fetch_array($result1); $city = $row['city']; $state = $row['state']; $zip = $row['zip']; $address = $row['address']; $depot = $row['depot']; $query2 = "SELECT address, city, state, zip FROM depot WHERE depot='$depot'"; $result2 = mysql_query($query2) or die ('Invalid Query2 - Cannot retrieve equipment Type' .mysql_error() ); $row2=mysql_fetch_array($result2); $depotCity = $row['city']; $depotState = $row['state']; $depotZip = $row['zip']; $depotAddress = $row['address']; PHP:
That seriously could of been spotted within the first couple minutes of troubleshooting.... Did you even bother to try to figure it out before posting?
What you needed to do is keep track of your variable names. You filled $row2 with data, then took the data from $row, which was the data from the first query, which is why you got the same data with the second query. You need to establish a method of working. Either use a new variable name each time or reuse your variable names. Don't switch between the two.