how would I escape the ' char from the retrieved data in the select statement?
Well, to start with, you should ask yourself why the escaping is needed.
Take for example this SQL statement:
SELECT columnname FROM tablename WHERE columnname='$value'
Suppose $value contained "bogu's text". Now the SQL statement would be sent to the database for parsing as:
SELECT columnname FROM tablename WHERE columnname='bogu's text';
The database's SQL parser will choke on this, since it sees the SQL statement as:
SELECT columnname FROM tablename WHERE columnname='bogu'
with a mysterious trailing string "s text'" that does not seem to belong anywhere.
With this, we can conclude that we should escape when constructing SQL statements. There is then no need to escape again when retrieving from the database, since the database's SQL parser would have stripped away the escaping characters, leaving us with the original text.
In your code snippet, we would then write:
$query_Recordset2 = "SELECT resumes.RESUME_ID, resumes.FULL_NAME
FROM resumes, facilities
WHERE resumes.FULL_NAME = '" . mysql_real_escape_string($stripnha) . "'";
without using str_replace() on $stripnha.