Hi guys,
This is really bugging me as I cant get it to work:
$proname = "John";
$samesurn = "SELECT * FROM $stb WHERE s_sur='(SELECT s_sur FROM $stb WHERE s_name='$proname')' AND s_name!='$proname' ";
$sameresult = mysql_query($samesurn);
while($samerow = mysql_fetch_array($sameresult)) {
$matchsur = $samerow['s_sur'];
echo $matchsur;
$samerow++;
}
I am trying to do this query:
$proname has a list of values in s_sur. I want to query the database to see who else has the same values and then display the results excluding $proname's own results.
Hope that makes sense. The error I get is mysql_fetch_array(): supplied argument is not a valid MySQL result.
Any help greatly appreciated.