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? Link to comment https://forums.phpfreaks.com/topic/277622-mysql_error/ Share on other sites More sharing options...
davidannis Posted May 4, 2013 Share Posted May 4, 2013 If there was no error mysql_error returns and empty string. Are you sure that the database returned an error? Quote 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. Link to comment https://forums.phpfreaks.com/topic/277622-mysql_error/#findComment-1428178 Share on other sites More sharing options...
reisve Posted May 4, 2013 Author Share Posted May 4, 2013 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"); } Link to comment https://forums.phpfreaks.com/topic/277622-mysql_error/#findComment-1428214 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 Link to comment https://forums.phpfreaks.com/topic/277622-mysql_error/#findComment-1428220 Share on other sites More sharing options...
reisve Posted May 5, 2013 Author Share Posted May 5, 2013 That was the problem. Thank You very much Link to comment https://forums.phpfreaks.com/topic/277622-mysql_error/#findComment-1428347 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.