Spraban9 Posted March 21, 2013 Share Posted March 21, 2013 hi friends this coding is not working <center> <?php if($_POST['name'] != '' && $_POST['comf'] != ''){ $name=$_POST['name']; $comf = $_POST['comf']; include("include/connection.php"); if (!$conn) { die('Could not connect: ' . mysql_error()); } mysql_select_db($database , $conn) or die (mysql_error()); $result = mysql_query("select user,randomno from customer where user = '$name' and randomno='$comf'"); if(mysql_num_rows($result)>0) { mysqli_query("UPDATE customer SET active = 1 WHERE user='$name' ") or die(mysql_error()); } } ?> <form name="frmconfor" id="frmconfor" method="post" action="comformation.php"> <table width="536" height="265" id="font" > <tr> <td height="62" class="style9"><label>UserName</label></td> <td><input required name="name" type="text" value="" /></td> </tr> <tr> <td height="62" class="style9"><label>Conformation Code</label></td> <td><input required name="comf" type="text" value="" /></td> </tr> <tr> <td height="118" colspan="2"> <div align="center"> <input name="submit" type="submit" value="submit"/> </div></td> </tr> </table> </form></center> Quote Link to comment https://forums.phpfreaks.com/topic/275970-update-not-working/ Share on other sites More sharing options...
haku Posted March 21, 2013 Share Posted March 21, 2013 (edited) I'm assuming that when you try to run it, a kitten dies. Or does 'not working' mean something else? Edited March 21, 2013 by haku Quote Link to comment https://forums.phpfreaks.com/topic/275970-update-not-working/#findComment-1420119 Share on other sites More sharing options...
DaveyK Posted March 21, 2013 Share Posted March 21, 2013 You are using the mysqli class on the update query, rather than the MySQL class. This will caus an error . The use for MySQL is discouraged though. Feel free to use mysqli or pdo_mysql. Don't harm kittens! Quote Link to comment https://forums.phpfreaks.com/topic/275970-update-not-working/#findComment-1420219 Share on other sites More sharing options...
Spraban9 Posted March 23, 2013 Author Share Posted March 23, 2013 <?php if(isset($_POST['update'])){ $comf = $_POST['comf']; include("include/connection.php"); if (!$conn) { die('Could not connect: ' . mysql_error()); } mysql_select_db($database , $conn) or die (mysql_error()); $que1="update customer set active = 1 where randomno = '$comf' " ; $retval = mysql_query( $que1, $conn ); if(! $retval ) { die('Could not update data: ' . mysql_error()); } echo "Updated data successfully\n"; mysql_close($conn); } else { ?> <span style="float:right">Welcome to Addfreeads upload site <?php echo $name ?> </span> <label id="dis"> <h3><?php echo $saved?> </h3></label><br> <form name="frmconfor" id="frmconfor" method="post" action="<?php $_PHP_SELF ?>"> <h2> Enter your Verfication code here</h2> <table width="536" height="265" id="font" > <tr> <td height="62" class="style9"><label>Conformation Code</label></td> <td><input required name="comf" type="text" value="" /></td> </tr> <tr> <td height="118" colspan="2"> <div align="center"> <input name="update" type="submit" id="update" value="Update"> </div></td> </tr> </table> </form> <?php } ?> </center> i change coding like this but update not working Quote Link to comment https://forums.phpfreaks.com/topic/275970-update-not-working/#findComment-1420470 Share on other sites More sharing options...
haku Posted March 23, 2013 Share Posted March 23, 2013 Do you want us to read your mind to guess what 'not working' means? Quote Link to comment https://forums.phpfreaks.com/topic/275970-update-not-working/#findComment-1420473 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.