djfox Posted September 13, 2007 Share Posted September 13, 2007 settings.php <?php //Date: September 13 2007 //For: secrettrance.net //Description: Manage Profile: Update Settings session_start(); include("dbcon.php"); include("func.php"); require_once "design.php"; require_once "auth.php"; require_once "includes/defines.php"; $id = $_SESSION['gal']; $lev=$_SESSION['level2']; $Title = "Secret Trance: Manage Profile: Update Settings"; require_once "header.php"; require_once "hidestatus.php"; if (!isLoggedIn()) { Redirect("index.php"); } ?> <table border=0 width=100%><? //1 ?> <tr> <td> <table border=0 width=100% bgcolor="000000"><? //2 ?> <tr> <td background="<? echo "$boxbanner"; ?>"><b>Manage Profile: Update Settings</b> <tr> <td background="<? echo "$boxback"; ?>"> <?php if( $lev > 0){ if( $suspend < 1){ $res = mysql_query("SELECT adult FROM userdata WHERE id='$id'"); $rows = mysql_fetch_row($res); mysql_free_result($res); ?> <blockquote> <font size=2><i>Change settings at your own risk. Secret Trance is not held respnsible for anything that could happen when any part of the settings are altered. By setting adult rating to "Adult/Mature", you are verifying that you are at least 18 years of age to view such content.</i></font> </blockquote> <form action="settings2.php"> <b>Adult Rating:</b> <br><select name="adult" style="border: 0px; background-color:#000000; color: #B6ABCE;"> <option value="0">Up to PG-13</option> <option value="1">Adult/Mature Content</option> </select> <p> <? echo "<input type='hidden' name='id' value='$id'>"; echo "<input type='submit' name='submit' value='Update Settings'>"; ?> </form> <?php } else { if( $suspend > 0){ echo "Sorry, your account is on suspension. You must wait until suspension expires before you can access this."; } } } ?> </table><? //2 ?> </table><? //1 ?> <p> <? require("footer.php"); ?> settings2.php <?php session_start(); include("dbcon.php"); include("auth.php"); //Date: September 13 2007 //For: secrettrance.net //Description: Update Settings if (!isLoggedIn()) { Redirect("index.php"); } $id = $_SESSION['gal']; mysql_query("UPDATE userdata SET adult='$adult' WHERE id=$id"); mysql_close($con); //redirect header("Location: manageprofile.php"); ?> It`s more or less the same codes I used to update other fields in databases but for some reason this one will not work. It will not update the adult field. It keeps leaving it at 1. Link to comment https://forums.phpfreaks.com/topic/69253-i-cant-see-where-the-problem-is-updating-a-field-in-the-database-table/ Share on other sites More sharing options...
djfox Posted September 13, 2007 Author Share Posted September 13, 2007 I removed this from settings.php: $res = mysql_query("SELECT adult FROM userdata WHERE id='$id'"); $rows = mysql_fetch_row($res); mysql_free_result($res); but that didn`t make any difference. Link to comment https://forums.phpfreaks.com/topic/69253-i-cant-see-where-the-problem-is-updating-a-field-in-the-database-table/#findComment-347996 Share on other sites More sharing options...
Jessica Posted September 14, 2007 Share Posted September 14, 2007 Try this: $adult = intval($_POST['adult']); $sql = "UPDATE userdata SET adult='$adult' WHERE id=$id"; mysql_query($sql) OR die(mysql_error().' with query: '.$sql); Link to comment https://forums.phpfreaks.com/topic/69253-i-cant-see-where-the-problem-is-updating-a-field-in-the-database-table/#findComment-348059 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.