ziedinjsh Posted October 15, 2009 Report Share Posted October 15, 2009 Vai kāds varētupateikt kas īsti viņam nepatīk: <?php include "misc/config.php"; $status = (isset($_GET['status'])) ? $_GET['status'] : ''; // savaac datus $submit = $_POST['register']; $username = strip_tags($_POST['username']); $email = strip_tags($_POST['email']); $password = strip_tags($_POST['passwords']); $password2 = strip_tags($_POST['passwords2']); $date = date("y-m-d"); if ($submit){ //paarbauda vai kkas nav tuksh if ($username&&$email&&$password&&$password2) { // vai paroles ir pareizas if ($password == $password2) { // username un email garums if (strlen($username)>50||strlen($email)>50) { echo "In username and email faild max is 50 sybols"; } else { //password garums if (strlen($password)>25||strlen($password)<6) { echo "Password most be between 6 and 25 characters"; } else { //user register //paroli nokodee uz md5 $password = md5($password); $password2 = md5($password2); $query = mysql_query ("INSERT INTO users VALUES ('','$username','$email','$password','$date')"); die ("You are registed"); } } else echo "Youre password do not match!"; } else echo "Please fill all feilds"; echo "<form method='post' action='".$_SERVER['PHP_SELF']."'>"; echo "<table>"; echo "<tr>"; echo "<td>username</td><td><input type='text' name='username' value='$username'></td>"; echo "</tr><tr>"; echo "<td>email</td><td><input type='email' name='email' value='$email'></td>"; echo "</tr><tr>"; echo "<td>password</td><td><input type='password' name='password'></td>"; echo "</tr><tr>"; echo "<td>password2</td><td><input type='password' name='password2'></td>"; echo "</tr><tr>"; echo "<td></td><td><input type='submit' name='register' value='register'></td>"; echo "</tr>"; echo "</table>"; ?> Parse error: syntax error, unexpected T_ELSE in /home/produc/public_html/mp3/1/register.php on line 54 es nesaprotu kas ar to else man jādara.. acis jau nerāda kur ir kļūda rāda 54 rindiņu.. bet ko lai es ar viņu daru? Quote Link to comment Share on other sites More sharing options...
briedis Posted October 15, 2009 Report Share Posted October 15, 2009 Noteikti esi kaut kur aizmirsis(vai lieku ielicis) kādu figūriekavu... Tu kodā vispār mēdz atsist kaut kādas atstarpes(rindu sākumā)? Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted October 15, 2009 Author Report Share Posted October 15, 2009 it kā jau jā Quote Link to comment Share on other sites More sharing options...
waplet Posted October 15, 2009 Report Share Posted October 15, 2009 ņem notepad2 un skatis pie kuras iekavas vai brekets būs zillā krāsa iekrāsojusies Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted October 15, 2009 Author Report Share Posted October 15, 2009 viss man ir melns un line skaitļi ir sarkani.. nekur zils nav :| Quote Link to comment Share on other sites More sharing options...
briedis Posted October 15, 2009 Report Share Posted October 15, 2009 viss man ir melns un line skaitļi ir sarkani.. nekur zils nav :| Paprovē Notepad++ palietot, dzīve vieglāka būs. Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted October 15, 2009 Author Report Share Posted October 15, 2009 provēju jau..skatījos tur tās figūriekavas.. kur ir + un - bet es nesaprotu kā es varu zināt kad ķēde noslēdas un kur nē Quote Link to comment Share on other sites More sharing options...
briedis Posted October 15, 2009 Report Share Posted October 15, 2009 (edited) provēju jau..skatījos tur tās figūriekavas.. kur ir + un - bet es nesaprotu kā es varu zināt kad ķēde noslēdas un kur nē Ja ķēde noslēdzas, tad viņš izceļ iekavas, ja nē, tad neizceļ. Galu galā, tak raksti normāli visur ar tām iekavām nevis vietām ar, vietām bez. ..un liec tab'us veidojot jaunus blokus, piem if(){ //lalal }else{ if(){ //lalal }else{ if(){ //lalal }else{ if(){ //lalal } } }else{ if(){ //lalal } } } nevis if(){ //lalal }else{ if(){ //lalal }else{ if(){ //lalal }else{ if(){ //lalal } } }else{ if(){ //lalal } } } Edited October 15, 2009 by briedis Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted October 15, 2009 Report Share Posted October 15, 2009 Ja nemaldos, tad tev trūkst aizverošā figūriekava trešajam ifam, bet tajā haosiņā ir grūti kaut ko saprast. Vai tiešām tu neliec tabus nekur? Kā arī, ja pēc nosacījuma seko tikai viena darbība, tad tā nav jāliek figuriekavās - tas nebūtu īpaši jāizmanto, sevišķi, ja ir tik daudz sazarojumi. if($one) { echo "One"; } elseif($two) { echo "Two"; } elseif($three) { echo "Three"; } else { echo "Four"; } 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.