anonīms Posted August 4, 2010 Report Share Posted August 4, 2010 SQL struktūra t_id, user_id, trase1, trase2, trase3, trase4, trase5, trase6, karta HTML - http://paste.php.lv/eb5ea5eb61aa098a80e8f3f7943adfc7/nonum PHP - print_r($_POST); echo '<hr />'; foreach($_POST as $trases_laiks=>$users) { echo "INSERT INTO ".PREFIX."racing_rezultati (t_id, user_id, trase1, trase2, trase3,trase4,trase5,trase6) VALUES ('".$tourney['id']."', '".$users."','".$trases_laiks."','',)<br />"; } print_r($_POST); Array ( [trase1] => Array ( [1] => 00:00 [147] => 00:00 [349] => 00:00 [145] => 00:00 [159] => 00:00 [198] => 00:00 [405] => 00:00 [115] => 00:00 ) [trase2] => Array ( [1] => 00:00 [147] => 00:00 [349] => 00:00 [145] => 00:00 [159] => 00:00 [198] => 00:00 [405] => 00:00 [115] => 00:00 ) [trase3] => Array ( [1] => 00:00 [147] => 00:00 [349] => 00:00 [145] => 00:00 [159] => 00:00 [198] => 00:00 [405] => 00:00 [115] => 00:00 ) [trase4] => Array ( [1] => 00:00 [147] => 00:00 [349] => 00:00 [145] => 00:00 [159] => 00:00 [198] => 00:00 [405] => 00:00 [115] => 00:00 ) [trase5] => Array ( [1] => 00:00 [147] => 00:00 [349] => 00:00 [145] => 00:00 [159] => 00:00 [198] => 00:00 [405] => 00:00 [115] => 00:00 ) [trase6] => Array ( [1] => 00:00 [147] => 00:00 [349] => 00:00 [145] => 00:00 [159] => 00:00 [198] => 00:00 [405] => 00:00 [115] => 00:00 ) ) PHP? - Pēc posta echo var redzēt, ka es vēl testēju kā tie variabļi strādās. Principā man ir jāizdara tā, ka katram lietotājam savada katras trases laiku iekšs db (piemērs cerams ir skaidrs). echo pašlaik izvada INSERT INTO bliezamv3_racing_rezultati (t_id, user_id, trase1, trase2, trase3,trase4,trase5,trase6) VALUES ('523', 'Array','trase6','',) Quote Link to comment Share on other sites More sharing options...
marcis Posted August 4, 2010 Report Share Posted August 4, 2010 (edited) Un kāds tieši bija jautājums? P.S. Kverijs ciklā ļoti iesūkā uz performanci :) Edited August 4, 2010 by marcis Quote Link to comment Share on other sites More sharing options...
anonīms Posted August 4, 2010 Author Report Share Posted August 4, 2010 (edited) Tad kā savādāk varētu to visu izveidot? nu labi - kaut vai tos arraju vākt ārā pa vienam. Teiksim $array_data[user_id][kartes_laiks] kkā tā Edited August 4, 2010 by anonīms Quote Link to comment Share on other sites More sharing options...
Леший Posted August 4, 2010 Report Share Posted August 4, 2010 (edited) INSERT INTO table (fields) VALUES (ieraksts1), (ieraksts2), (...) UN! Tev jātaisā foreach($_POST as $trase=>$val){ foreach ($val as $k=>$v) {} } Edited August 4, 2010 by Леший Quote Link to comment Share on other sites More sharing options...
waplet Posted August 4, 2010 Report Share Posted August 4, 2010 (edited) vai tad labāk nebūtu pierakstīt foreach($_POST as $trase=>$val) foreach($val as $k=>$v){ } tā būs īsāk :D Edited August 4, 2010 by waplet Quote Link to comment Share on other sites More sharing options...
Леший Posted August 4, 2010 Report Share Posted August 4, 2010 Nav MVC :P 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.