Vecteevs Posted April 22, 2010 Report Share Posted April 22, 2010 Sveiki, ir doma izveidot dažu rindiņu rediģēšanas iespēju, bet īsti nezinu kā to darīt. Precīzāk man vajadzēs rediģēt manu noteikto valūtas kursu. Piemēram: LVL --> WMZ 1.860 WMZ --> LVL 0.495 LR --> WMZ 0.870 WMZ --> LR 0.985 gribu lai tos skaitļus varētu mainīt no admina paneļa. Kas man būtu jāraksta index lapā un kas admin lapā? Quote Link to comment Share on other sites More sharing options...
ohmygod Posted April 22, 2010 Report Share Posted April 22, 2010 LOL Man nesen kam līdzīgam prasīja tāmi ;) pilnam servisam ar webmoney. Ka tik nabūs piemetušies kādam, kas vispār neko nesaprot :D Quote Link to comment Share on other sites More sharing options...
Vecteevs Posted April 22, 2010 Author Report Share Posted April 22, 2010 ne ne :D tas ir tā piemēram kā es apmēram gribu lai izskatās Quote Link to comment Share on other sites More sharing options...
m8t Posted April 22, 2010 Report Share Posted April 22, 2010 Index lapā būtu jāidrukā informācija, bet administrācijas panelī vajadzētu uzlikt fīču ar kuru var mainīt valūtas kursu. Index: http://www.w3schools.com/php/php_mysql_select.asp Admin: http://www.w3schools.com/php/php_mysql_update.asp Quote Link to comment Share on other sites More sharing options...
ohmygod Posted April 22, 2010 Report Share Posted April 22, 2010 Nu primitīvā variantā tev nepieciešama tabula ar valūtu no, valūtu uz un kursu. Like CREATE TABLE kursi ( kursa_id Int AUTO_INCREMENT, valuta_no Char(20), valuta_uz Char(20), kurss Decimal(10,5) ) ENGINE = MyISAM ; Tad uztaisi pievienošanas formu, kurā var ievadīt valūtu nosaukumus un kursu. --> php savāc formas datu un INSERT INTO kursi (valuta_no, valuta_uz, kurss) VALUES ('$valuta_no','$valuta_uz','$kurss') Labo ar UPDATE viss Quote Link to comment Share on other sites More sharing options...
Vecteevs Posted April 22, 2010 Author Report Share Posted April 22, 2010 (edited) tad man jādara tā? <form name="forma" method="post" action="test.php"> <input type="text" name="kurss" id="kurss"> <input type="text" name="valuta_no" id="valuta_no"> <input type="text" name="valuta_uz" id="valuta_uz"> <input type="submit" name="nosutit" id="button" value="Nosutit"> apmēram kas līdzīgs? Edited April 22, 2010 by Vecteevs Quote Link to comment Share on other sites More sharing options...
ohmygod Posted April 22, 2010 Report Share Posted April 22, 2010 Diezgan ļoti līdzīgs (: Un tad jāsaņem ar $_POST vērtības, jāsaliek INSERTā un jāizpilda mysql_query Quote Link to comment Share on other sites More sharing options...
Vecteevs Posted April 22, 2010 Author Report Share Posted April 22, 2010 un kā to visu var ieprintēt lapā? Quote Link to comment Share on other sites More sharing options...
ohmygod Posted April 22, 2010 Report Share Posted April 22, 2010 Paņemsi no DB ar SELECT un no php ar echo parādīsi. Quote Link to comment Share on other sites More sharing options...
Vecteevs Posted April 26, 2010 Author Report Share Posted April 26, 2010 (edited) viss sanāca tikai labošanu nesanāk salikt.. kāds var palīdzēt uzrakstīt formu? izveidotais update <?php $con = mysql_connect("localhost","root","xxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("manadb", $con); mysql_query("UPDATE kursi SET kurss = '36' WHERE kurss_no = 'PP' AND kurss_uz = 'LR' AND kurss = '3.456'"); mysql_close($con); ?> kā lai to update izdara caur formu? AND kurss = '3.456'"); reāli man vajag tikai šo mainīt Edited April 26, 2010 by Vecteevs Quote Link to comment Share on other sites More sharing options...
xPtv45z Posted April 26, 2010 Report Share Posted April 26, 2010 Forma, ir tāda pati, kā pie pievienošanas, tikai attiecīgi, jau aizpildīta ar iepriekšējiem datiem. Quote Link to comment Share on other sites More sharing options...
Vecteevs Posted April 26, 2010 Author Report Share Posted April 26, 2010 bāc, man nesanāk uzrakstīt :( Quote Link to comment Share on other sites More sharing options...
m8t Posted April 26, 2010 Report Share Posted April 26, 2010 <?php if(isset($_POST['forma'])) { $con = mysql_connect("localhost","root","xxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("manadb", $con); $_POST['forma'] = mysql_real_escape_string($_POST['forma']); mysql_query("UPDATE kursi SET kurss = '{$_POST['forma']}' WHERE kurss_no = 'PP' AND kurss_uz = 'LR'"); mysql_close($con); } ?> <form method="post"> <input type="text" name="forma" /> <input type="submit" value="aiziet" /> </form> Kaut kā tā? Quote Link to comment Share on other sites More sharing options...
Vecteevs Posted April 26, 2010 Author Report Share Posted April 26, 2010 jā, strādā. Paldies :) 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.