FT3 Posted October 23, 2010 Report Share Posted October 23, 2010 (edited) Te tads jautajums ! Links ir tads ?go=movie - vins uzrada $result = mysql_query("SELECT * FROM movie ORDER BY id"); + man vjg lai links butu ?go=movie&cat1 - lai vins uzraditu $2result = mysql_query("SELECT * FROM movie ORDER BY id WHERE category = '$category'"); ja $category ir 1 tad ?go=movie&cat1 ja $category ir 2 tad ?go=movie&cat2 ja $category ir 3 tad ?go=movie&cat3 un tajas lapas ieks $2result izvadus ! Cerams sapratat :D :D Edited October 23, 2010 by FT3 Quote Link to comment Share on other sites More sharing options...
nikidijs Posted October 23, 2010 Report Share Posted October 23, 2010 (edited) Manuprāt tur būtu labāk nevis ?go=movie&cat1 bet gan ?go=movie&cat=1 un attiecīgi: $2result = mysql_query("SELECT * FROM movie WHERE category='".$_GET['cat']."' ORDER by id"); Edited October 23, 2010 by nikidijs Quote Link to comment Share on other sites More sharing options...
FT3 Posted October 23, 2010 Author Report Share Posted October 23, 2010 errors Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in C:\AppServ\www\modules\movie.php on line 13 Quote Link to comment Share on other sites More sharing options...
FT3 Posted October 23, 2010 Author Report Share Posted October 23, 2010 sorry pa db bet ta pati kļuda Quote Link to comment Share on other sites More sharing options...
Rincewind Posted October 23, 2010 Report Share Posted October 23, 2010 errors Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in C:\AppServ\www\modules\movie.php on line 13 Mainīgā vārds nevar sākties ar ciparu. Quote Link to comment Share on other sites More sharing options...
FT3 Posted October 23, 2010 Author Report Share Posted October 23, 2010 (edited) yap pereizi tnx tgd zinašu :) un nikidijs teu ari liels plds viss strada ;) bet ka tgd ustajsit lai ja link ?go=movie uzrada visu pec kartas bet ja ?go=movie&cat=0 tas cakigorijas izvadus? Edited October 23, 2010 by FT3 Quote Link to comment Share on other sites More sharing options...
Rincewind Posted October 23, 2010 Report Share Posted October 23, 2010 Man liekas ka pareizāk būtu: if(isset($_GET['cat'])){ $result=mysql_query(blablabla ar cat); }else{ $result=mysql_query(blablabla bez cat); } Drošība nav svarīga? Ar šitādiem query tev ļaunie jūzeri datubāzi ātri nograus. Quote Link to comment Share on other sites More sharing options...
FT3 Posted October 23, 2010 Author Report Share Posted October 23, 2010 a ka lai taisa lai neko nenograuž ? :D :D Quote Link to comment Share on other sites More sharing options...
Rincewind Posted October 23, 2010 Report Share Posted October 23, 2010 a ka lai taisa lai neko nenograuž ? :D :D Konkrētajā gadījumā pietiks ja $_GET['cat'] vietā ierakstīs (int)$_GET['cat'] Quote Link to comment Share on other sites More sharing options...
FT3 Posted October 23, 2010 Author Report Share Posted October 23, 2010 pie izvades nomainiju bet if(isset($_GET['cat'])){ $result=mysql_query(blablabla ar cat); }else{ $result=mysql_query(blablabla bez cat); } šaja koda nau jamaina ? Quote Link to comment Share on other sites More sharing options...
Rincewind Posted October 23, 2010 Report Share Posted October 23, 2010 if(isset($_GET['cat'])){ $result=mysql_query("SELECT * FROM movie WHERE category=".(int)$_GET['cat']." ORDER by id"); }else{ $result=mysql_query("SELECT * FROM movie ORDER by id"); } Quote Link to comment Share on other sites More sharing options...
FT3 Posted October 23, 2010 Author Report Share Posted October 23, 2010 ja man šaja koda tieši tapats uzlikts tnx par to GET ;) Quote Link to comment Share on other sites More sharing options...
daGrevis Posted October 23, 2010 Report Share Posted October 23, 2010 mysql_real_escape_string() Quote Link to comment Share on other sites More sharing options...
FT3 Posted October 25, 2010 Author Report Share Posted October 25, 2010 mysql_real_escape_string() ? ? Quote Link to comment Share on other sites More sharing options...
mefisto Posted October 25, 2010 Report Share Posted October 25, 2010 daGrevis: http://php.net/manual/en/pdo.prepare.php Mūsdienās jaunam kodam nevajadzētu saturēt mysql_* funkcijas. 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.