reisve Posted May 4, 2013 Share Posted May 4, 2013 HiI have this piece of code part of a larger code block: $page = '../../register.php'; $msg = $error['register']; $msg .= mysql_error($link); header("Location: templates/frontend/error.php?msg=$msg&page=$page"); everything works if I remove the "$msg .= mysql_error($link);" line. the line bellow comes from a language, file and if the Mysql_error is not on the line, it shows up. with the mysql_error, just get ablank lineAny help please? Quote Link to comment Share on other sites More sharing options...
davidannis Posted May 4, 2013 Share Posted May 4, 2013 (edited) If there was no error mysql_error returns and empty string. Are you sure that the database returned an error? Returns the error text from the last MySQL function, or '' (empty string) if no error occurred. http://php.net/manual/en/function.mysql-error.php] Also: Do a view source and see if there is something returned that you are not seeing. Edited May 4, 2013 by davidannis Quote Link to comment Share on other sites More sharing options...
reisve Posted May 4, 2013 Author Share Posted May 4, 2013 (edited) according the code flow, there was an error, and if the error line is not there I got my error message. Just would like to add the MySQL error itself: $query = "INSERT INTO users (first_name, last_name, email, c_user, c_pass, c_type) VALUES ('$f_fname', '$f_lname', '$f_email', '$f_user', '$cryptpass', '$f_type')"; if (mysqli_query($link, $query)){ $page = '../../index.php'; $msg = $info['register']; header("Location: templates/frontend/info.php?msg=$msg&page=$page"); } else { $page = '../../register.php'; $msg = $error['register']; $msg .= mysql_error($link); header("Location: templates/frontend/error.php?msg=$msg&page=$page"); } Edited May 4, 2013 by reisve Quote Link to comment Share on other sites More sharing options...
davidannis Posted May 4, 2013 Share Posted May 4, 2013 You are using mysqli above and mysql below. Use mysqli_error Quote Link to comment Share on other sites More sharing options...
Solution reisve Posted May 5, 2013 Author Solution Share Posted May 5, 2013 That was the problem. Thank You very much Quote Link to comment 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.