uwannadonkey Posted August 23, 2007 Share Posted August 23, 2007 this wont be added to mysql db <?php include('inc/header.php'); $name=$_post[name]; if(isset($_POST[submit])) { //Insert pilots //setup our query $query= 'INSERT INTO clan(name, king, viceking, gold, diamond, crystal) VALUES("' . $name . '", "' . $user->display_name . '", 0, 100, 10, 1)'; $rt=mysql_query($query); echo"$_POST[name] Clan has been made."; mysql_query("update `users` SET clan='$name' WHERE ID=$user->ID"); mysql_query("update `users` SET clanrank=127 WHERE ID=$user->ID"); } if ($user->clanrank == 0) { echo ' Join a clan, or create one<br>'; echo 'Create a clan<br> <form method=post name=train> Clan Name: <input name=name size=12 maxlength=20> <br> <input type=submit name=submit id=submit value=Create Clan> '; } else { echo'blah blah'; } include('inc/footer.php'); ?> prolly another careless error? Quote Link to comment https://forums.phpfreaks.com/topic/66385-solved-wont-add-to-mysql-db/ Share on other sites More sharing options...
phpSensei Posted August 23, 2007 Share Posted August 23, 2007 This Line is wrong : $query= 'INSERT INTO clan(name, king, viceking, gold, diamond, crystal,) Remove the comma after 'Crystal'. Quote Link to comment https://forums.phpfreaks.com/topic/66385-solved-wont-add-to-mysql-db/#findComment-332216 Share on other sites More sharing options...
uwannadonkey Posted August 23, 2007 Author Share Posted August 23, 2007 any other errors? cuz for some reason, the name wotn enter ANY of the db's(user, or clan) Quote Link to comment https://forums.phpfreaks.com/topic/66385-solved-wont-add-to-mysql-db/#findComment-332219 Share on other sites More sharing options...
MadTechie Posted August 23, 2007 Share Posted August 23, 2007 change mysql_query("update `users` SET clan='$name' WHERE ID=$user->ID"); to mysql_query("update `users` SET clan='$name' WHERE ID=$user->ID") or die(mysql_error()); it will tell you the errors! Quote Link to comment https://forums.phpfreaks.com/topic/66385-solved-wont-add-to-mysql-db/#findComment-332222 Share on other sites More sharing options...
uwannadonkey Posted August 23, 2007 Author Share Posted August 23, 2007 no errorss... for the record, both of them are var char 255 in db Quote Link to comment https://forums.phpfreaks.com/topic/66385-solved-wont-add-to-mysql-db/#findComment-332223 Share on other sites More sharing options...
LiamProductions Posted August 23, 2007 Share Posted August 23, 2007 Maybe the line has to be $var = $_POST['name']; Quote Link to comment https://forums.phpfreaks.com/topic/66385-solved-wont-add-to-mysql-db/#findComment-332231 Share on other sites More sharing options...
phpSensei Posted August 23, 2007 Share Posted August 23, 2007 put quotes between the brackets on line one of your script. change to $_POST['name']; Quote Link to comment https://forums.phpfreaks.com/topic/66385-solved-wont-add-to-mysql-db/#findComment-332232 Share on other sites More sharing options...
Jessica Posted August 23, 2007 Share Posted August 23, 2007 $name=$_post[name]; I think you need to change this to $name=$_POST['name']; Add this to the top of your pages: ini_set('display_errors', 1); error_reporting(E_ALL); Quote Link to comment https://forums.phpfreaks.com/topic/66385-solved-wont-add-to-mysql-db/#findComment-332233 Share on other sites More sharing options...
marcus Posted August 23, 2007 Share Posted August 23, 2007 You're saying you can't add the info to the database? Is all your POST data correct? (e.g., the field names) Have you tried using "or die(mysql_error())" on the actual insert query? Quote Link to comment https://forums.phpfreaks.com/topic/66385-solved-wont-add-to-mysql-db/#findComment-332235 Share on other sites More sharing options...
uwannadonkey Posted August 23, 2007 Author Share Posted August 23, 2007 nope, liam was right, it had to be $var. thanks for the help everyone and mgall, yea, when madtechie asked me to, i added it, and the problem was there Quote Link to comment https://forums.phpfreaks.com/topic/66385-solved-wont-add-to-mysql-db/#findComment-332236 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.