student Posted November 21, 2010 Report Share Posted November 21, 2010 (edited) Tagad man ir pilns register un viss notiek,vienīgi,kad ir dati ievietoti iekšā db tad firefox atver lapu ar tekstu:"Problēma ar lapas ielādi".Ko man darīt lai tas tā nenotiek (visas adreses ievietotas pareizi!)? Šis ir register.html --> <form name="login" method="post" action="register.php"> <table border="0" width="225" align="center"> <tr> <td width="219" bgcolor="#999999"> <p align="center"><font color="white"><span style="font-size:12pt;"><b>Registration</b></span></font></p> </td> </tr> <tr> <td width="219"> <table border="0" width="282" align="center"> <tr> <td width="116"><span style="font-size:10pt;">Name:</span></td> <td width="156"><input type="text" name="name" maxlength="100"></td> </tr> <tr> <td width="116"><span style="font-size:10pt;">Email:</span></td> <td width="156"><input type="text" name="email" maxlength="100"></td> </tr> <tr> <td width="116"><span style="font-size:10pt;">Username:</span></td> <td width="156"><input type="text" name="username"></td> </tr> <tr> <td width="116"><span style="font-size:10pt;">Password:</span></td> <td width="156"><input type="password" name="password"></td> </tr> <tr> <td width="116"> </td> <td width="156"> <p align="right"><input type="submit" name="submit" value="Submit"></p> </td> </tr> </table> </td> </tr> <tr> <td width="219" bgcolor="#999999"> </td> </tr> </table> </form> Šis ir register.php --> <?php //Database Information $dbhost = "localhost"; $dbname = "users"; $dbuser = "root"; $dbpass = ""; //Connect to database mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error()); mysql_select_db($dbname) or die(mysql_error()); $name = $_POST['name']; $email = $_POST['email']; $username = $_POST['username']; $password = md5($_POST['password']); // lets check to see if the username already exists $checkuser = mysql_query("SELECT username FROM users WHERE username='$username'"); $username_exist = mysql_num_rows($checkuser); if($username_exist > 0){ echo "I'm sorry but the username you specified has already been taken. Please pick another one."; unset($username); include 'register.html'; exit(); } // lf no errors present with the username // use a query to insert the data into the database. $query = "INSERT INTO users (name, email, username, password) VALUES('$name', '$email', '$username', '$password')"; mysql_query($query) or die(mysql_error()); mysql_close(); echo "You have successfully Registered"; ?> Edited November 21, 2010 by student Quote Link to comment Share on other sites More sharing options...
xmas12 Posted November 21, 2010 Report Share Posted November 21, 2010 DRīzāk nevajadzētu būt : include 'register.php'; ??? nevis register.html ? Quote Link to comment Share on other sites More sharing options...
student Posted November 21, 2010 Author Report Share Posted November 21, 2010 Nē,tur viss ok.Izņemot to daļu un atstājot tikai echo... notiek tieši tas pats.Ieliekas dati iekšā db,bet parādās tas firefox error.Šitas register ir sadalīts divos failos.Html un php. Quote Link to comment Share on other sites More sharing options...
daGrevis Posted November 21, 2010 Report Share Posted November 21, 2010 Kāpēc nevar izmantot " "!? Tas kods taču tikai tāpēc ir nelasāms un puse no visiem foruma lietotājiem nemaz necenšas palīdzēt... =( 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.