blink359 Posted April 26, 2009 Share Posted April 26, 2009 I dont know whats wrong but somethings wrong with this <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> <!-- .style1 {font-size: small} #apDiv1 { position:absolute; left:37px; top:210px; width:169px; height:30px; z-index:1; } body { background-color: #999999; } .cssnav { position: relative; font-family: arial, helvetica, sans-serif; background: url(images/overbtn.jpg) no-repeat; white-space: nowrap; display: block; width: 250px; height: 50px; margin: 0; padding: 0; } .cssnav a { display: block; color: #000000; font-size: 11px; width: 250px; height: 50px; display: block; float: left; color: black; text-decoration: none; } .cssnav img { width: 250px; height: 50px; border: 0 } * html a:hover { visibility:visible } .cssnav a:hover img { visibility:hidden } .cssnav span { position: absolute; left: 53px; top: 15px; margin: 0px; padding: 0px; cursor: pointer; width: 250px; } .style4 {font-size: 16px} --> </style> </head> <body> <center><table width="80%" border="1"> <tr> <th height="186" colspan="5" align="left" valign="top" scope="row"><img src="Images/logo2.jpg" width="944" height="215" /></th> </tr> <tr> <th width="25%" rowspan="2" align="left" valign="top" scope="row"><h2> <div class="cssnav"><a href="index.html" title="Search Engine Optimization"><img src="images/downbtn.jpg" alt="Search Engine Optimization" /><span class="style4">Home</span></a></div> <div class="cssnav"><a href="register.php" title="Search Engine Submission"><img src="images/downbtn.jpg" alt="Search Engine Submission" /><span class="style4">Create Account</span></a></div> <div class="cssnav"><a href="phpbb3/index.php" title="Website Design"><img src="images/downbtn.jpg" alt="Website Design" /><span class="style4">Forums</span></a></div> <div class="cssnav"><a href="vote.php" title="Website Promotion"><img src="images/downbtn.jpg" alt="Website Promotion" /><span class="style4">Vote</span></a></div> <div class="cssnav"><a href="donate.html" title="Google"><img src="images/downbtn.jpg" alt="Google" /><span class="style4">Donate</span></a></div> <br /> </h2> </th> <td colspan="3" rowspan="3" valign="top"> <center><form method="post" action=""> <p> <?php $dbhost = "localhost"; $dbuser = "nathan"; $dbpass = "your_password"; $dbname = "logon"; mysql_connect($dbhost, $dbuser, $dbpass); mysql_select_db($dbname); $user = $_POST['user']; $pass = $_POST['pass']; $pass2 = $_POST['pass2']; $flag = $_POST['flag']; $success = true; $problemMessage = ""; if (isset($_POST['Submit'])) { if(!$user || !$pass || !$pass2) { $problemMessage .= "Please complete all required data <br />"; $success = false; } if(strlen($user) < 5) { $problemMessage .= "User must be more that 5 characters <br />"; $success = false; } if(strlen($user) > 20) { $problemMessage .= "Your username cannot be longer than 20 characters <br />"; $success = false; } if($pass != $pass2) { $problemMessage .= "Your passwords do not match <br />"; $success = false; } if(strlen($pass2) < 5) { $problemMessage .= "Your password must be more than 5 characters<br />"; $success = false; } if(strlen($pass2) > 20) { $problemMessage .= "Your password cannot be longer than 20 characters <br />"; $success = false; } $result = mysql_query("SELECT * FROM `accounts` where username='$user';") or die("Error: (" . mysql_errno() . ") " . mysql_error()); if(isset(!$result)) { $problemMessage .= "The username already exists <br />"; $success = false; } if ($success) { echo "Valid New Account Entry<br />"; $result = mysql_query("INSERT INTO `accounts` VALUES ('', '$user', '$pass2', '', '', '0', '9', '', '', '$flag', 'enUS', '0', '0', null);") or die("Error: (" . mysql_errno() . ") " . mysql_error()); } $row = mysql_fetch_array( $result ); // Print out the contents of the entry ?> <?php if ($success == false) { echo $problemMessage; } ?> Account Creation Page<br> Username: <input name="user" type="text"/> <br> Password: <input name="pass" type="text"/> <br> Repeat Password: <input name="pass2" tpye="text"/> <br /> Pre TBC <input type="radio" name="flag" value="0"> <br> TBC Enabled <input type="radio" name="flag" value="8"> <br> Wotlk Enabled <input type="radio" name="flag" value="24"> <br> <input name="Submit" type="submit" value="submit" /> </p> <imput name="reset" type="reset" value="reset" /> </form></center></td> <td width="22%" height="114">Login to forums</td> </tr> <tr> <td height="129" valign="top"><p class="style1">Donate now to keep our server up</p> <p class="style1"><a href="http://www.paypal.com"><img src="Images/Paypal.png" width="207" height="87" /></a></p></td> </tr> <tr> <th height="224" valign="top" scope="row"><br /></th> <td><p> </p> </td> </tr> <tr> <th height="33" colspan="5" scope="row"> </th> </tr> </table> </center> </body> </html> Pasted from Mibbit ajax IRC client, on 26-Apr-2009 10:53:29 UTC Quote Link to comment https://forums.phpfreaks.com/topic/155712-solved-something-wrong-with-account-creation/ Share on other sites More sharing options...
wildteen88 Posted April 26, 2009 Share Posted April 26, 2009 Like what... How do we know how your script is supposed to work. You need to give us more info. What is it you're trying to do. What is your script supposed to do, and what result are you getting etc. Quote Link to comment https://forums.phpfreaks.com/topic/155712-solved-something-wrong-with-account-creation/#findComment-819610 Share on other sites More sharing options...
mrMarcus Posted April 26, 2009 Share Posted April 26, 2009 you check the flux capacitor? Quote Link to comment https://forums.phpfreaks.com/topic/155712-solved-something-wrong-with-account-creation/#findComment-819611 Share on other sites More sharing options...
blink359 Posted April 26, 2009 Author Share Posted April 26, 2009 Its ment to put information into a table called accounts with there username $user password $pass and there account type 0 8 or 24 which is there choice $flag Quote Link to comment https://forums.phpfreaks.com/topic/155712-solved-something-wrong-with-account-creation/#findComment-819620 Share on other sites More sharing options...
blink359 Posted April 26, 2009 Author Share Posted April 26, 2009 Problem is Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/nathan/testreg.php on line 156 This line: $row = mysql_fetch_array( $result ); Quote Link to comment https://forums.phpfreaks.com/topic/155712-solved-something-wrong-with-account-creation/#findComment-819622 Share on other sites More sharing options...
mrMarcus Posted April 26, 2009 Share Posted April 26, 2009 that's telling you that there is something wrong with your query(s) .. your code needs to be better organized and errors need to be better handled. you have two (2) $result variables, so start by changing the names, ie. $select_result and $insert_result .. something like that .. but that's just the beginning. you should use mysql_num_rows to check if records have been retrieved from the db successfully instead of if(isset(!$result)) use if (mysql_num_rows($result) > 0) { or if (mysql_num_rows($result) == 0) { depending on which way you prefer to take your code. basically, what you were trying to do on line 156 is a command used on select statements, not insert statements. so, when your script ran through to the db INSERT, $row = mysql_fetch_array($result) is reading the $result var form the INSERT statement. Quote Link to comment https://forums.phpfreaks.com/topic/155712-solved-something-wrong-with-account-creation/#findComment-819627 Share on other sites More sharing options...
mrMarcus Posted April 26, 2009 Share Posted April 26, 2009 and for future reference, lose all the HTML and CSS when posting code, unless it's somehow relevant .. just too much to scan through. Quote Link to comment https://forums.phpfreaks.com/topic/155712-solved-something-wrong-with-account-creation/#findComment-819628 Share on other sites More sharing options...
blink359 Posted April 26, 2009 Author Share Posted April 26, 2009 Thanks Quote Link to comment https://forums.phpfreaks.com/topic/155712-solved-something-wrong-with-account-creation/#findComment-819637 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.