krisis32 Posted February 25, 2010 Report Posted February 25, 2010 (edited) Sveiki visi! Varbūt kādam kaut kur ir aizķēries, vai arī būtu tik labs un varētu izveidot tādu kā skriptu. Ko skripts darīs? Būs tāda, kā anketa. NIKS: SKYPE: KOMANDA(drop down lists ar komandām): (tās komandas kuras jau ir aizsūtītas ar SUBMIT pogu vairāk drop down sarakstā neparādas) Tad uzspiež pogu SŪTĪT/SUBMIT un infa nonāk DB noteiktā tabulā un tad NIKS/SKYPE/KOMANDA tike izvadīta lapā noteiktajā vietā! Var arī izveidot līdz tam ka infa nonāk DB. Tālāk pats centīšos izgudrot! Paldies jau iepriekš. Edited February 25, 2010 by krisis32 Quote
chizijs Posted February 25, 2010 Report Posted February 25, 2010 (edited) DB CREATE TABLE IF NOT EXISTS `tabula` ( `id` int(11) NOT NULL auto_increment, `niks` varchar(255) collate utf8_unicode_ci NOT NULL, `skype` varchar(255) collate utf8_unicode_ci NOT NULL, `komanda` varchar(255) collate utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3 ; index.php <? if($_POST['add']){ if($_POST['niks'] || $_POST['skype'] != ""){ $niks = mysql_real_escape_string($_POST['niks']); $skype = mysql_real_escape_string($_POST['skype']); $team = mysql_real_escape_string($_POST['team']); mysql_query("INSERT INTO tabula(niks, skype, komanda) VALUES('$niks', '$skype', '$team')") or die(mysql_error()); echo"ok"; }else{echo"aizpildi visus laukus";} } ?> <form method="post"> Niks <input name='niks' type='text'><br/> Skype <input name='skype' type='text'><br/> Komanda <select name='team'> <option value='komanda1'>Komanda1</option> <option value='komanda2'>Komanda2</option> </select> <input name='add' type='submit'> Edited February 25, 2010 by chizijs Quote
krisis32 Posted February 25, 2010 Author Report Posted February 25, 2010 Paldies par atbildi, bet man negrib viš strādāt! Quote
eT` Posted February 25, 2010 Report Posted February 25, 2010 tu skriptā izveidoji konekciju ar DB? sākumā ieliec: $db_host = 'localhost'; $db_user = 'user'; $db_password = 'parole'; $db_name = 'datubaaze'; $connection = mysql_connect($db_host, $db_user, $db_password) or die(mysql_error()); mysql_select_db($db_name, $connection); mysql_query("SET NAMES utf8"); Quote
krisis32 Posted February 25, 2010 Author Report Posted February 25, 2010 Jā izdariju, bet nestrādā! Quote
briedis Posted February 25, 2010 Report Posted February 25, 2010 Jā izdariju, bet nestrādā! Kas nestrādā? Kas rādās? Quote
krisis32 Posted February 25, 2010 Author Report Posted February 25, 2010 Nu es ierakstu visu ko vaig ierakstit. spiezu submit. visi laucini refreshojas un DB nenonaak nekas! Quote
briedis Posted February 25, 2010 Report Posted February 25, 2010 Nu es ierakstu visu ko vaig ierakstit. spiezu submit. visi laucini refreshojas un DB nenonaak nekas! ko satur mysql_error(); ? kādi kļūdu paziņojumi? Quote
briedis Posted February 25, 2010 Report Posted February 25, 2010 Lūk kods: KODS Ko man tas kods dod? Domā man tagad gribās veidot lokālu db, taisīt tabulas,testēt? Pasaki labāk ko satur mysql_error() uzreiz pēc kvērija izpildes. Quote
briedis Posted February 25, 2010 Report Posted February 25, 2010 Paprovē izlabot šo: <input name='add' type='submit'> uz šo <input name='add' type='submit' value='Pievienot'> Quote
briedis Posted February 25, 2010 Report Posted February 25, 2010 (edited) pieliec pašā augšā print_r($_POST), ko tas satur... (varu derēt, ka atkal kaut kāda debīla kļūda :D) EDIT.... Eeeem, norādi labāk action atribūtu formai... Edited February 25, 2010 by briedis Quote
chizijs Posted February 25, 2010 Report Posted February 25, 2010 amm.. varbūt noamini <? uz <?php Quote
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.