l4cky Posted February 8, 2011 Share Posted February 8, 2011 I want to make a table for each paddler_id (Field) which exists into pushup Database My code for paddler_id = 1 is require "../sql.php"; $result = mysql_query("EXPLAIN pushup"); $r = mysql_query("SELECT * FROM paddlerinfo t1 LEFT JOIN pushup t2 on t2.paddler_id=t1.id LEFT JOIN practicedate t3 on t3.practice=t2.practice_id ORDER BY t1.firstname ASC "); $r1 = mysql_query("SELECT * FROM pushup where paddler_id =1 ORDER BY practice_id ASC "); echo "<table width='30%' border='1' cellpadding='0' cellspacing='0' style='font-family: monospace'>"; echo "<tr>"; echo "<td>DATE</td>"; while ($row = mysql_fetch_array($result)) { if (in_array($row["Field"], array("paddler_id", "practice_id", "p_id"))) continue; echo "<td>",($row["Field"]), "</td>"; } echo "</tr>"; while (($data = mysql_fetch_array($r1, MYSQL_ASSOC)) !== FALSE) { unset($data["p_id"],$data["paddler_id"]); echo "<tr>"; foreach ($data as $k => $v) { echo "<td>"; echo"$v"; echo "</td>"; } echo "</tr>"; } echo "</table>"; mysql_free_result($result); mysql_free_result($r); mysql_free_result($r1); mysql_close(); The problem is on line $r1 = mysql_query("SELECT * FROM pushup where paddler_id =1 ORDER BY practice_id ASC "); I want to put something which makes it paddler_id = X where x = 2,3,4,5... and x exists in database and do not print twice the x (because that database may have rows where x = same id How do i do that?? Link to comment https://forums.phpfreaks.com/topic/227042-please-help-select-db-where-field-is-an-array-and-loop-table-how/ Share on other sites More sharing options...
l4cky Posted February 9, 2011 Author Share Posted February 9, 2011 Anyone? Link to comment https://forums.phpfreaks.com/topic/227042-please-help-select-db-where-field-is-an-array-and-loop-table-how/#findComment-1171650 Share on other sites More sharing options...
BlueSkyIS Posted February 9, 2011 Share Posted February 9, 2011 i don't answer because i think this proposition is a bad one: I want to make a table for each paddler_id you should not be making tables for any reason. mostly. Link to comment https://forums.phpfreaks.com/topic/227042-please-help-select-db-where-field-is-an-array-and-loop-table-how/#findComment-1171659 Share on other sites More sharing options...
Pikachu2000 Posted February 9, 2011 Share Posted February 9, 2011 I agree. That sounds like a very poor database design. Link to comment https://forums.phpfreaks.com/topic/227042-please-help-select-db-where-field-is-an-array-and-loop-table-how/#findComment-1171661 Share on other sites More sharing options...
l4cky Posted February 9, 2011 Author Share Posted February 9, 2011 what do you mean? i am new to php and sql i would like to put on my website the stats of team members.. how can i do that? Link to comment https://forums.phpfreaks.com/topic/227042-please-help-select-db-where-field-is-an-array-and-loop-table-how/#findComment-1171666 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.