ANALGINS Posted February 5, 2010 Report Share Posted February 5, 2010 veletos atrisinat mazu problemu kas man ir uzradusies tatad ir 3 linki kas maina mainigos ( datu baazes tabulas sauc 1,2,3) <a href="?db=1">1</a> | <a href="?db=2">2</a> | <a href="?db=3">3</a> skriptaa ir vairaki pieprasijumi, add, delete, edit, oder by.. kas un kaa man butu jaraksta lai es varetu pieskirt $_GET ka mainigo ko nolasitu un man mainitos tabula, un nevajadzetu katrai tabulai kopet savu skripta failu tabulu lauki ir identiski lidz shim visadi izmeginajos bet shis laikam nestrada ka vaig mysql_query("select * from '".$_GET['db']."' order BY '".$_GET['sort']."'"); ludzu paradiet kaa iztaisnot savas likas rokas Link to comment Share on other sites More sharing options...
w4p1337 Posted February 5, 2010 Report Share Posted February 5, 2010 pirmkārt, labāk parādi visu kā tev ir. otrkārt, kur ir mysql_real_escape_string(); ? Link to comment Share on other sites More sharing options...
ANALGINS Posted February 5, 2010 Author Report Share Posted February 5, 2010 datubazes nosaukums - dbaaze tabulu nosaukumi ir 1,2,3 gribu ar sho vienu skriptu parslegties starp tabulam spiezhot uz linkiem kas turpatas augsha ir.. ja variet piedavajiet citas idejas, manas rokas ir gana liikas lai megjinatu kko domat.. all.php Link to comment Share on other sites More sharing options...
KpC Posted February 6, 2010 Report Share Posted February 6, 2010 Uztaisi variblu db, kurš satur vajadzīgo db ciparu. if(is_numeric($_GET['db']){ $db = intval($_GET['db']); }else{ $db = 1; } Tālāk, kad selekto visu informāciju izmanto nevis ciparu, bet to db variblu. $select = mysql_query("SELECT * FROM '".$db."'"); Link to comment Share on other sites More sharing options...
ANALGINS Posted February 6, 2010 Author Report Share Posted February 6, 2010 vai sho piemeru varu ari pielietot uz vardiem ? 1,2,3 es devu ka piemeru lai vieglak saprast butu jums.. isteniba man ir 3 vardi kaa db tabulu nosaukumi.. Link to comment Share on other sites More sharing options...
KpC Posted February 6, 2010 Report Share Posted February 6, 2010 (edited) if($_GET['db'] == 'news'){ $db = news; } elseif($_GET['db'] == 'news2'){ $db = news2; } elseif($_GET['db'] == 'news3'){ $db = news3; } else{ $db = news; } Edited February 6, 2010 by KpC Link to comment Share on other sites More sharing options...
ANALGINS Posted February 6, 2010 Author Report Share Posted February 6, 2010 (edited) liels paldies, tagad vis tikpatka strada, ja neskaita to ka add edit del funkcijas darbojas tikai uz pirmo tablulu es domaju tur linki nedaudz butu japartaisa lai butu teiksim shadi ?db=1?act=add lai vinjsh lai skripts stumtu izmainjas konkretajaa tabulaa es domaju pareiza virziena vai kludos ? Edited February 6, 2010 by ANALGINS Link to comment Share on other sites More sharing options...
KpC Posted February 6, 2010 Report Share Posted February 6, 2010 Virziens pareizs, bet kods gan nē.. <a href="http://localhost/?db=1&act=add">Pievienot</a> Link to comment Share on other sites More sharing options...
ANALGINS Posted February 6, 2010 Author Report Share Posted February 6, 2010 jaa to es 5min atpakal apzinajos kad testeju.. tagad radas jautajums ka lai es $db variabli uztaisu dinamisku vai ka tas skaitas isti nezinu tb ja ir db=3 tad visiem linkiem butu ?db=3&dzid=1 (db3 dzest id 1) man radas doma to paveikt shadi ?db=$db&dzid bet testejot izradijas vinjsh $db neaizstaj ar tabulas nosaukumu ka sho varetu risinat ? Link to comment Share on other sites More sharing options...
KpC Posted February 6, 2010 Report Share Posted February 6, 2010 (edited) <? echo "<a href=\"http://localhost/?db=",$db,"&act=dzid\">Dzēst ",$db,"</a>"; ?> (fixed) Edited February 6, 2010 by KpC Link to comment Share on other sites More sharing options...
w4p1337 Posted February 6, 2010 Report Share Posted February 6, 2010 KpC nepareiza sintakse... un es nesaprotu par to dinamiskumu , ko tu ANALgins gribi panakt.! Link to comment Share on other sites More sharing options...
ANALGINS Posted February 6, 2010 Author Report Share Posted February 6, 2010 tagad kad varu parslegties par tabulam, un redzet to saturu, gribu arii atiecigajai tabulai pievienot/labot/dzest ierakstus, tapec vaig dinamisku linku sistemu uztaisit, lai nebutu jataisa 18 linki jo ir vairakas tabulas.. es domaju es sapratu kpc ideju un to tolitas ari pameginashu.. Link to comment Share on other sites More sharing options...
X ID Posted February 6, 2010 Report Share Posted February 6, 2010 http_build_query(), ja saproti, ko es ar to domāju Link to comment Share on other sites More sharing options...
ANALGINS Posted February 6, 2010 Author Report Share Posted February 6, 2010 (edited) X ID - nojaushu meginaju shadi <a href="?db=",$db,"&act=add">Pievienot jaunu</a> bet ta vietaa links darbojas lidz db= un talak kas aiz ", nekjer.. edit: fixed, paldies par atbildem Edited February 6, 2010 by ANALGINS Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now