Hi
I changed my script to use prepared statement., but it does not work. Don’t get any error or success message. Can someone help me with this?
Thank You
[php]
<?php include "lib/configuration.php"; include "language/frontend/portuguese.php"; if ($_POST) { $f_fname = $_POST['fname']; $f_lname = $_POST['lname']; $f_email = $_POST['email']; $f_user = $_POST['user']; $f_pass1 = $_POST['pass1']; $f_pass2 = $_POST['pass2']; $f_type = 0; if ($f_pass2 == $f_pass1) { $cryptpass = md5($f_pass1); } else { echo $registererror['password']; /* Returns to register page */ $link = mysqli_connect($host, $user, $pass, $db); /* check connection */ if (mysqli_connect_errno()) { echo $error['dbconnection']; exit(); } $query = "SELECT * FROM users WHERE c_name = $f_user"; if ($result = mysqli_query($link, $query)){ $rowcount = mysqli_num_rows($result); if ($rowcount > 1){ mysqli_free_result($result); echo $registererror['duplicate']; /* Returns to register page */ } } else { $query = "INSERT INTO users (first_name, last_name, email, c_user, c_pass, c_type) VALUES (?,?,?,?,?,?)"; $stmt = mysqli_prepare($link, $query); mysqli_stmt_bind_param($stmt, "ssssss", $f_fname, $f_lname, $f_email, $f_user, $cryptpass, $f_type); /* Execute the statement */ mysqli_stmt_execute($stmt); if (mysqli_stmt_errno($stmt)){ echo $registererror['register'] . mysqli_stmt_error($stmt); /* Returns to index page (in the future may send an email to admin */ } else { echo $registerinfo['register']; /* Returns to index page */ } } /* close statement */ mysqli_stmt_close($stmt); /* close connection */ mysqli_close($link); } } else { include "templates/frontend/header.tpl"; include "templates/frontend/loginspace.tpl"; include "templates/frontend/registerlogin.tpl"; include "templates/frontend/searchspace.tpl"; include "templates/frontend/search.tpl"; include "templates/frontend/hmenuspace.tpl"; include "templates/frontend/menubar.tpl"; include "templates/frontend/leftspace.tpl"; include "templates/frontend/leftside.tpl"; include "templates/frontend/contentspace.tpl"; include "templates/frontend/register.tpl"; include "templates/frontend/rightspace.tpl"; include "templates/frontend/rightside.tpl"; include "templates/frontend/footerspace.tpl"; include "templates/frontend/footerdiv.tpl"; include "templates/frontend/footer.tpl"; } ?>[/php]