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?? Quote Link to comment Share on other sites More sharing options...
l4cky Posted February 9, 2011 Author Share Posted February 9, 2011 Anyone? Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.