Help With Php Update Function - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › Help With Php Update Function (750 Views)
1 Reply
| Help With Php Update Function by charliebiz(op): 5:03pm On Apr 23, 2013 |
I created this function to update a database when the submit button is click but it seems not to work. please I need help debugging it. <?php include_once('libraries.php'); // contains the database function function update(){ db(); // database function $pname = $_POST['pname']; $categoryid = $_POST['categoryid']; $email = $_POST['email']; $phone = $_POST['phone']; $user = $_POST['users']; $pass = $_POST['pass']; function createSalt() { $string = md5(uniqid(rand(), true)); return substr($string, 0, 3); }; $salt = createSalt(); $hash = hash('sha256', $salt . $pass); $sql = "UPDATE users SET user=?,pass=?,salt=?,pname=?,email=?,phone=? WHERE categoryid=?"; $q = $conn->prepare($sql); $q->execute(array($user,$hash,$salt,$pname,$email,$phone,$categoryid)); } ?> |
| Re: Help With Php Update Function by jacob05(m): 8:05pm On Apr 23, 2013 |
I think you should have something like
and the createSalt() function should be declared outside the update function.... |
| Re: Help With Php Update Function by prodam(m): 10:16am On Apr 24, 2013 |
itz nt working?...whatz d error?..nothin seems 2 b wrong with this code snippet..if this is the action file of ur form, and all field names are correct, then there shuld be no bug or even mosquitoe... |
Sorting Out A Simple Text Dictionary With PHP • Without Using Pow Function In C • 2 • 3 • 4
Mtnapp Developer Challenge 2013 • Is It Difficult? • Can Some Ans This Pls