I'm not sure if I can answer your question directly. I'd say double check the correct param is being passed - because if you type the wrong param you wont get an error and nothing will update.
Anyways, I went ahead and tried to rewrite the code. This should work and give you errors and success messages:
<?php /**************************************************** * Settings *****************************************************/ // MySQL Connection Settings $settings['mysql']['host'] = "localhost"; $settings['mysql']['user'] = "root"; $settings['mysql']['pass'] = "af981t58time"; $settings['mysql']['dbname'] = "dev_andy_sms"; /**************************************************** * Connections *****************************************************/ $con = mysql_connect($settings['mysql']['host'], $settings['mysql']['user'], $settings['mysql']['pass']) or die('Error: Could not connect to mysql, Please check server, username and password.'); @mysql_query("CREATE DATABASE IF NOT EXISTS ".$settings['mysql']['dbname']); $ok = mysql_select_db($settings['mysql']['dbname'], $con) or die("Could not connect to the specified database on line ".__LINE__.": ".mysql_error()); //Set the param variable from the URL via $_GET $gparam = mysql_real_escape_string(htmlspecialchars(trim($_GET["param"]))); ?> <form action="<?php echo $PHP_SELF; ?>" method="post" name="form1"> <input type="text" name="param" value="<?php echo $gparam; ?>" disabled="disabled" /> <input type="submit" name="submit" id="submit" value="Submit" /> </form> <?php if(isset($_POST['submit'])){ //Get param from the form $param = mysql_real_escape_string(htmlspecialchars(trim($_POST["param"]))); if(!empty($param)){ //First, lets check if the param exists...if you type the wrong param, then you wont get an error message and no result. $c = mysql_query("SELECT * FROM table_name WHERE param_code='$param' LIMIT 1"); $cc = mysql_num_rows($c); if($cc > 0){ $ud = mysql_query("UPDATE table_name SET code_used='0' WHERE param_code='$param'"); if($ud){ echo "Successfully Updated!"; }else{ echo "There was an error: ".mysql_error(); } }else{ echo "There Param does not exists in the database!"; /*$code = "0"; // or $code = "1"; $ins = mysql_query("INSERT INTO table_name (id,param_code,code_used) VALUES (id,'$param','$code')"); if($ins){ echo "Successfully Inserted!"; }else{ echo "There was an error inserting: ".mysql_error(); } */ } }else{ echo "No param was present"; } } mysql_close($con); ?>
I got no param was present...