hEiti Posted June 11, 2008 Report Share Posted June 11, 2008 $sql="INSERT INTO raksts (virsraksts, teksts, ) Ideja tada .. html menucis ar idejisku eng un lv ja lietotajs izvelas eng tad pirms raksts tiek pielikts eng_raksts, bet ja lv tad lv_raksts un pec izveleta tekstu ko raxta feeldos raxta db atkarigaja db.. ceru kad domu saprata. Dodat kadu padomu Link to comment Share on other sites More sharing options...
andrisp Posted June 11, 2008 Report Share Posted June 11, 2008 if (valoda ir lv) { $tabula = 'lv_raksts'; } elseif (valoda ir en) { $tabula = 'eng_raksts'; } $sql = "INSERT INTO ".$tabula." ... "; Link to comment Share on other sites More sharing options...
hEiti Posted June 11, 2008 Author Report Share Posted June 11, 2008 isti nesanak tikt gala .. html dalja forma ir : <select name="valoda"> <option value="eng">Eng</option> <option>Rus</option> <option value="lv">Lat</option> <option>Esp</option> <option>Por</option> <option>Fra</option> </select> bet php dalja ka tu teici : <?php if (valoda = "lv") { $tabula = 'lv_raksts'; } elseif (valoda = "eng") { $tabula = 'eng_raksts' $con = mysql_connect("...","...","..."); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("baltrotors", $con); $sql="INSERT INTO ".$tabula." (virsraksts, teksts) Link to comment Share on other sites More sharing options...
andrisp Posted June 11, 2008 Report Share Posted June 11, 2008 Palasi par pamatsintaksi (php.net). Formas mainīgajiem piekļūst vai nu caru $_POST vai nu $_GET. Ja jau atver bloku ar {, tad aizvērt taču arī vajadzētu. Kverijas arī nav pabeigts līdz galam. Link to comment Share on other sites More sharing options...
hEiti Posted June 11, 2008 Author Report Share Posted June 11, 2008 Salasijos pa $_GET bet tik un ta sezu domaju nevar izprast to veidu ka es vinju sheit varu iexa iemest jo itka pec butibas vinjam vertipu pieskjir formas.php bet norade par db ir faila insert.php .. varbut vari kko uz dzivas adas paradit? jo tiesham nevar saprast shito lietu.. galu gala man ir padoma sataiist news sistem kas rakstus nem atkarigi no valodas kas izveleta lapa.. <?php if (valoda = 'lv') { $tabula = 'l_raksts'; } elseif (valoda = 'eng') { $tabula = 'eng_raksts' } elseif (valoda = 'esp') { $tabula = 'esp_raksts' } elseif (valoda = 'fr') { $tabula = 'fra_raksts' } elseif (valoda = 'de') { $tabula = 'de_raksts' } elseif (valoda = 'ru') { $tabula = 'ru_raksts' } $con = mysql_connect("","",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("", $con); $sql="INSERT INTO ?????? (virsraksts, teksts) VALUES ('$_POST[virsraksts]','$_POST[teksts]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con) ?> Link to comment Share on other sites More sharing options...
andrisp Posted June 11, 2008 Report Share Posted June 11, 2008 $_GET['valoda'] vai $_POST['valoda']. Atkarībā, kas tev ir pie <form action=""> Link to comment Share on other sites More sharing options...
hEiti Posted June 11, 2008 Author Report Share Posted June 11, 2008 (edited) $_GET['valoda'] vai $_POST['valoda']. Atkarībā, kas tev ir pie <form action=""> pie form action ir insert.php nuu ja itka es ielieku taja starpa $sql="INSERT INTO "$_POST['valoda']" (virsraksts, teksts) bet tik un ta kad spiezu post pogu vinsh paliek pie balta ekrana nevis padod zinju kad 1 rec ievietots .. :( Edited June 11, 2008 by hEiti Link to comment Share on other sites More sharing options...
andrisp Posted June 11, 2008 Report Share Posted June 11, 2008 Pārteicos - pie method. Link to comment Share on other sites More sharing options...
bubu Posted June 11, 2008 Report Share Posted June 11, 2008 Ne jau action, bet gan method. Link to comment Share on other sites More sharing options...
hEiti Posted June 11, 2008 Author Report Share Posted June 11, 2008 post Link to comment Share on other sites More sharing options...
andrisp Posted June 11, 2008 Report Share Posted June 11, 2008 hEiti, a ko tad tu gaidīji ? Tev vai tad ir tabulas "lv", "eng" utt ? Link to comment Share on other sites More sharing options...
hEiti Posted June 11, 2008 Author Report Share Posted June 11, 2008 nu man ir eng_raksts, lv_raksts un pareja gara pentere :) Link to comment Share on other sites More sharing options...
andrisp Posted June 11, 2008 Report Share Posted June 11, 2008 Mēs taču to jau zinām. Padomā labāk pats, ko tu tajā kodā dari. Link to comment Share on other sites More sharing options...
hEiti Posted June 11, 2008 Author Report Share Posted June 11, 2008 es te galvu sakjeris sezu biroja jau ~40 min un domaju ,.. taka davay bez ironijas un parakajam pargudriban vnk skaidri un gaishi pasaki ko vajag izmainit lai tur kkas ripotu uz priexu.. Link to comment Share on other sites More sharing options...
andrisp Posted June 11, 2008 Report Share Posted June 11, 2008 Prieškam ? Lai tu pēc tam saņemtu naudu par kodu, kuru tavā vietā rakstījuši citi, un no kura pašam nav ne mazākās sajēgas ? Tas, ka tu neizproti elementāras pamatlietas, ir tava paša vaina. Cik jābūt izliekušam PHP programmētājam, lai nesaprastu, ka jādara ir šādi ? if ($_POST['valoda'] == 'lv') { $tabula = 'lv_raksts'; } elseif ($_POST['valoda'] == 'en') { $tabula = 'eng_raksts'; } $sql = "INSERT INTO ".$tabula." ... "; Link to comment Share on other sites More sharing options...
Recommended Posts