false Posted November 19, 2009 Report Share Posted November 19, 2009 Erors: Notice: Undefined index: p in C:\xampp\xampp\htdocs\index.php on line 77 Viss kods (77.rinda ir switch ($_REQUEST['p']) {) <?php switch ($_REQUEST['p']) { case 'news': if(!isset($_SESSION['id'])) { } if(isset($_SESSION['id'])) { $time_sw = time(); $updeit = mysql_query("UPDATE lietotaaji SET pedeja_akt=".$time_sw." AND SET time=".$time_sw." WHERE id=".$id.""); } include_once('news.php'); break; case 'forum': if(!isset($_SESSION['id'])) { } default: $time_sw = time(); $updeit = mysql_query("UPDATE lietotaaji SET time=".$time_sw.""); include_once('news.php'); break; } ?> Meiģināju likt šadi: switch (isset($_REQUEST['p'])) { Tad vispār neiet tās switch Tad vēl šadi: if(($_REQUEST['p'])){ switch ($_REQUEST['p']) { ... }} Arī negāja.. Kāds var palīdzet atrisināt šo problēmu? Quote Link to comment Share on other sites More sharing options...
briedis Posted November 19, 2009 Report Share Posted November 19, 2009 (edited) fail after fail :) if(isset(kaut kas)){ switch(kaut kas){ .. } } READ THE FUCKING MANUAL... Edited November 19, 2009 by briedis Quote Link to comment Share on other sites More sharing options...
waplet Posted November 19, 2009 Report Share Posted November 19, 2009 $p = $_REQUEST['p']; vai arī izmanto labāk POST un GET Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted November 19, 2009 Report Share Posted November 19, 2009 Reāli tas ir tikai notice, kas nav nekas traks. Lai nu kā: $_REQUEST vietā es ieteiktu rakstīt vai nu $_GET vai $_POST, atkarībā kas tad tev īsti tika dots lai atkratītos no notice, vari darīt tā: $p = (isset($_REQUEST['p']) ? $_REQUEST['p'] : ""; switch($p) { // te tas pats, kas tavā kodā } Būtībā notice saka, ka tas masīvā $_REQUEST neeksistē elements ar indeksu p. Quote Link to comment Share on other sites More sharing options...
false Posted November 19, 2009 Author Report Share Posted November 19, 2009 Reāli tas ir tikai notice, kas nav nekas traks. Lai nu kā: $_REQUEST vietā es ieteiktu rakstīt vai nu $_GET vai $_POST, atkarībā kas tad tev īsti tika dots lai atkratītos no notice, vari darīt tā: $p = (isset($_REQUEST['p']) ? $_REQUEST['p'] : ""; switch($p) { // te tas pats, kas tavā kodā } Būtībā notice saka, ka tas masīvā $_REQUEST neeksistē elements ar indeksu p. Parse error: syntax error, unexpected ';' in C:\xampp\xampp\htdocs\index.php on line 77 77.rinda: $p = (isset($_REQUEST['p']) ? $_REQUEST['p'] : ""; Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted November 19, 2009 Report Share Posted November 19, 2009 (edited) trūkst aizverošā iekava: (isset($_REQUEST['p'])) Edited November 19, 2009 by rATRIJS Quote Link to comment Share on other sites More sharing options...
briedis Posted November 19, 2009 Report Share Posted November 19, 2009 (edited) Uzmini nu, kur tev šeit ir sintakses kļūda: $p = (isset($_REQUEST['p']) ? $_REQUEST['p'] : ""; rATRIJ, fu, kauns, nu nevar šitā teikt priekšā! Pats neko neiemācīsies! :) Edited November 19, 2009 by briedis Quote Link to comment Share on other sites More sharing options...
waplet Posted November 19, 2009 Report Share Posted November 19, 2009 Viņš tač izlaboja :)(= 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.