Jump to content
php.lv forumi

$_POST un foreach


anonīms

Recommended Posts

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','',)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...