I have a query that gets a number of cols off my database
$searchResults = mysql_query("SELECT customerRefId, seekingAddressSuburb,
seekingAddressPostcode, seekingAddressState FROM customer_seeking");
Then I use the data to display a HTML table
?>
<table border="1">
<th>Customer Ref ID</th>
<th>Suburb</th>
<th>State</th>
<th>Postcode</th>
<?php
while($row=mysql_fetch_array($searchResults))
{
echo"<tr><td>$row[customerRefId]</td><td>$row[seekingAddressSuburb]</td><td>$row[seekingAddressPostcode]</td><td>$row[seekingAddressState]</td></tr>";
}
?>
</table>
What I need to do next is have another query as per below, but instead of hard coding 9,10
I want to use the $row[customerRefId]
for the IN ()
Should I use mysql_data_seek($searchResults,0);
to retun to the top of the sql results or should I build an arrary?
$searchResults2 = mysql_query("SELECT customerRefId, firstName, lastName, email, phone, mobile FROM customer_contact WHERE customerRefId IN (9,10)");
mysql_
. In the meantime, may I ask what your website's URL is?mysql_
calls to access your database. Maybe use PDO. See php.net/manual/en/pdo.query.php