I have this table:
------------------------------
|ID | name | employee_code |
------------------------------
|24 | Robert | 20234 |
------------------------------
AND
-------------------------------------
|ID | job_code | team |
-------------------------------------
|24 | 241124 | Robert, Eduard, Etc. |
-------------------------------------
I want to search in second table by employee code and i try something like this:
$sql=mysql_query("SELECT * FROM works WHERE (SELECT name FROM employee WHERE employee_code LIKE '%".$_GET['employee_code']."%' AS searchname) team Like %searchname% ");
Result:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
mysql_error()to your query -$sql=mysql_query("SELECT * FROM ...) or die(mysql_error());job_codefrom 2nd table must be the same asemployee codeform 1st one?mysqlfunctions are now deprecated. Please look at usingPDOormysqliinstead.