chandrajit1988 Posted May 3, 2010 Share Posted May 3, 2010 THIS IS MY CODE: "<?php mysql_select_db("service", $db_handle); $result = mysql_query("SELECT tp_id, email, Rating FROM tp_info WHERE tp_id.tp_info=user_skills.tp_info HAVING user_skills.sub_id=job_info.sub_id"); echo "<table border='1'> <tr> <th>Tradesperson Username</th> <th>Tradesperson Email</th> <th>Rating</th> </tr>"; while($row = mysql_fetch_array($result))//ERROR LINE HERE { echo "<tr>"; echo "<td>" . $row['tp_id'] . "</td>"; echo "<td>" . $row['email'] . "</td>"; echo "<td>" . $row['Rating'] . "</td>"; echo "</tr>"; } echo "</table>"; ?> WHA SHOULD I DO TO SORT THIS OUT??? Link to comment https://forums.phpfreaks.com/topic/200566-mysql_fetch_array-expects-parameter-1-to-be-resource-please-help/ Share on other sites More sharing options...
Muddy_Funster Posted May 3, 2010 Share Posted May 3, 2010 Have you tested your query in MySQL? If not you could try: SELECT tp_id, email, Rating FROM tp_info INNER JOIN user_skills ON (tp_id.tp_info=user_skills.tp_info) WHERE user_skills.sub_id = job_info.sub_id Your use of HAVING is a bit off, it should only be used to limit a GROUP BY, not to refine an existing WHERE clause. Let us know how you get on. Link to comment https://forums.phpfreaks.com/topic/200566-mysql_fetch_array-expects-parameter-1-to-be-resource-please-help/#findComment-1052464 Share on other sites More sharing options...
chandrajit1988 Posted May 3, 2010 Author Share Posted May 3, 2010 The Table Structure is something like this: Table Name Field Name1 Field Name2 Field Name3 Field Name4 ============================================================== tp_info tp_id Rating email field4 user_skills tp_id sub_id job_info sub_id =============================================== I want to print tp_id,Rating,email from table-tp_info for only those tp_id that match tp_id from table-user_skills. Provided sub_id from table-user-skills match sub_info from table-job_info What should my query be like???? Link to comment https://forums.phpfreaks.com/topic/200566-mysql_fetch_array-expects-parameter-1-to-be-resource-please-help/#findComment-1052478 Share on other sites More sharing options...
Ken2k7 Posted May 3, 2010 Share Posted May 3, 2010 SELECT t.tp_id, t.Rating, t.email FROM tp_info t INNER JOIN user_skills u ON (t.tp_id = u.tp_id) INNER JOIN job_info j ON (u.sub_id = j.sub_id) Link to comment https://forums.phpfreaks.com/topic/200566-mysql_fetch_array-expects-parameter-1-to-be-resource-please-help/#findComment-1052484 Share on other sites More sharing options...
chandrajit1988 Posted May 3, 2010 Author Share Posted May 3, 2010 SELECT t.tp_id, t.Rating, t.email FROM tp_info t INNER JOIN user_skills u ON (t.tp_id = u.tp_id) INNER JOIN job_info j ON (u.sub_id = j.sub_id) THANKS A LOT.. PROBLEM SOLVED....... Link to comment https://forums.phpfreaks.com/topic/200566-mysql_fetch_array-expects-parameter-1-to-be-resource-please-help/#findComment-1052502 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.