blink359 Posted April 25, 2009 Share Posted April 25, 2009 Right ive solved my last problem but when i got to make an account it now says Error: (1136) Column count doesn't match value count at row Here is my code: <!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"> <!-- #apDiv1 { position:absolute; left:9px; top:336px; width:1144px; height:40px; z-index:1; } body,td,th { color: #FFFFFF; } body { background-color: #000000; } #apDiv2 { position:absolute; left:13px; top:417px; width:934px; height:1657px; z-index:1; } #apDiv3 { position:absolute; left:32px; top:32px; width:593px; height:101px; z-index:2; } .style1 { font-size: xx-large } --> </style> </head> <body> <div id="apDiv2"> <?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; } 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()); } } ?> <?php if ($success == false) { echo $problemMessage; } ?> <center><form method="post" action=""> 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" /> TBC Enabled<input type="radio" name="flag" value="8" /> WOTLK Enabled<input type="radio" name="flag" value="24" /> <input name="Submit" type="submit" value="submit" /> <imput name="reset" type="reset" value="reset" /> </form></center> </h1></div> <div id="apDiv3"> <h1 class="style1">Server Name Goes here</h1> </div> <p><img src="Images/Image2.jpg" width="1143" height="321" /></p> <p><a href="index.html"><img src="Images/Home.jpg" width="150" height="50" /></a><a href="phpbb3/index.php"><img src="Images/Forums.jpg" width="150" height="50" /></a><a href="Register.php"><img src="Images/Create.jpg" width="250" height="50" /></a><a href="vote.php"><img src="Images/Vote.jpg" width="150" height="50" /></a><a href="donate.html"><img src="Images/Donate.jpg" width="150" height="50" /></a></p> <p> </p> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/155608-new-problem-with-radio-buttons/ Share on other sites More sharing options...
DEVILofDARKNESS Posted April 25, 2009 Share Posted April 25, 2009 Probably you have somewhere in your query a rong value with a wrong column, to have a better view you can best do it this way: $result = mysql_query("INSERT INTO accounts(colum1name,column2name) VALUES ('column1value','column2value')"); And so on... this way you can check which value goes to which column. Quote Link to comment https://forums.phpfreaks.com/topic/155608-new-problem-with-radio-buttons/#findComment-818953 Share on other sites More sharing options...
blink359 Posted April 25, 2009 Author Share Posted April 25, 2009 But my mysql query is correct the only thing i changed from when it was working was $result = mysql_query("INSERT INTO `accounts` VALUES ('', '$user', '$pass2', '', '', '0', '9', '', '', '$flag', 'enUS', '0', '0', null)") where it says $flag it used to be 24 which is one of the possible values from my radio buttons which is: Pre TBC<input type="radio" name="flag" value="0" /> TBC Enabled<input type="radio" name="flag" value="8" /> WOTLK Enabled<input type="radio" name="flag" value="24" /> Quote Link to comment https://forums.phpfreaks.com/topic/155608-new-problem-with-radio-buttons/#findComment-818958 Share on other sites More sharing options...
DEVILofDARKNESS Posted April 25, 2009 Share Posted April 25, 2009 That's weird, but I currently have the same problem with one of my pages, the radio buttons don't send a value, You can check to see if they send a value, by somewhere echo'ing the $flag, or by print_r($flag), if nothing is shown, you have the same probl as I have Quote Link to comment https://forums.phpfreaks.com/topic/155608-new-problem-with-radio-buttons/#findComment-818962 Share on other sites More sharing options...
blink359 Posted April 25, 2009 Author Share Posted April 25, 2009 i mucked pretty much everything up on the register page now :'( gonna have to start it again now Quote Link to comment https://forums.phpfreaks.com/topic/155608-new-problem-with-radio-buttons/#findComment-818965 Share on other sites More sharing options...
DEVILofDARKNESS Posted April 25, 2009 Share Posted April 25, 2009 That's not true! Just wait a min., I'm discussing with some smart guys which is the problem in my code, and if they've found that, it is probably solved in your code as well. btw what is TBC and WOTLK? Quote Link to comment https://forums.phpfreaks.com/topic/155608-new-problem-with-radio-buttons/#findComment-818967 Share on other sites More sharing options...
blink359 Posted April 25, 2009 Author Share Posted April 25, 2009 it stands for account type of the private emulators of world of warcraft so 0 = no expansion 8 = the burning crusade expansion 24 = wrath of the lich king expansion Quote Link to comment https://forums.phpfreaks.com/topic/155608-new-problem-with-radio-buttons/#findComment-818968 Share on other sites More sharing options...
blink359 Posted April 25, 2009 Author Share Posted April 25, 2009 If this helps ive got my page hosted http://81.100.51.145/nathan/register.php please ignore the picture problem Quote Link to comment https://forums.phpfreaks.com/topic/155608-new-problem-with-radio-buttons/#findComment-819029 Share on other sites More sharing options...
DEVILofDARKNESS Posted April 25, 2009 Share Posted April 25, 2009 Have you already checked if the $flag contains a value with print_r($flag)?? Quote Link to comment https://forums.phpfreaks.com/topic/155608-new-problem-with-radio-buttons/#findComment-819077 Share on other sites More sharing options...
blink359 Posted April 25, 2009 Author Share Posted April 25, 2009 Where abouts should i write that as earlier i tried doing echo "$flag" and it didnt like where i typed it Quote Link to comment https://forums.phpfreaks.com/topic/155608-new-problem-with-radio-buttons/#findComment-819155 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.