adamlacombe Posted June 16, 2009 Share Posted June 16, 2009 I have this code: <?php $settings = mysql_query("SELECT * from gb_settings"); $srow = mysql_fetch_object($settings); if(isset($_POST['submit'])){ $sitename = $_POST['sitename']; $domain = $_POST['domain']; mysql_query('UPDATE gb_settings SET domain="$domain", sitename="$sitename" ') or die(mysql_error()); echo '<div class=\'msg\'>Updated.</div>'; exit; } echo '<form action=\'index.php?go=settings\' method=\'POST\'> <table align=\'center\' cellpadding=\'5\'> <tr> <th class=\'header5\' colspan=\'2\'>Settings</th> </tr> <td class="content5">Site Name:</td> <td class="content5"><input type="text" name="sitename" size="40" value="'; echo $srow->sitename; echo'"></td> </tr> <tr> <td class="content5">Domain:</td> <td class="content5"><input type="text" name="domain" size="40" value="'; echo $srow->domain; echo'"></td> </tr> <tr> <th colspan=\'2\' class=\'header5\'><input type=\'submit\' name=\'submit\' value=\'Change\'></th> </table> </form> '; ?> everything seems right to me but i dont know. When I submit the form it says it went through but when i check the database it just inserts " $domain " and " $sitename " instead of what I have in the textareas. any idea on whats wrong? Quote Link to comment https://forums.phpfreaks.com/topic/162404-solved-mysql-update-help/ Share on other sites More sharing options...
kickstart Posted June 16, 2009 Share Posted June 16, 2009 Hi Wrong kind of quote:- mysql_query("UPDATE gb_settings SET domain='$domain', sitename='$sitename' ") or die(mysql_error()); All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/162404-solved-mysql-update-help/#findComment-857199 Share on other sites More sharing options...
adamlacombe Posted June 16, 2009 Author Share Posted June 16, 2009 its always the easiest things to fix but the hardest to see. I dont know why I never thought of that. Thanks for the help! Quote Link to comment https://forums.phpfreaks.com/topic/162404-solved-mysql-update-help/#findComment-857201 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.